mirror of
https://github.com/narrrl/narl-workspace.git
synced 2026-11-04 08:57:00 +01:00
commands: one grammar for !, merged commands, a settings sheet, two-level help
A `!` now means force or everything and nothing else (`:w!`, `:search!`, `:export!`, `:logout!`). A command that did a second thing behind its bang takes a word for it instead: `:space new|name|rm`, `:list name|rm`, `:task [add]|edit`, `:upload seal`, `:import zip [/]`. `:card` while reading a document makes a card about it, so `:card!` is gone. Merged: `:export` downloads what has focus, a file as it is or a document as markdown (`:download` folded in); `:share [off|new]` replaces `:unshare` and `:link`, and the list's `s` and `y` give way to it and the info sheet; `:noh` replaces `:clear`; `:vault [unlock|lock|passwd]` replaces `:unlock`, `:lock` and `:passwd`; Esc in the list puts down what `m` picked up before it closes the document, replacing `:unmark`. The old spellings run as their new lines for one release through a table in commands.ts; help and Tab leave them out, and the wiki lists them. A settings sheet (`,` or `:settings`) holds the options, the vault, the backup, the signed-in browsers, ssh keys and capture tokens. Each row runs the command a line would. Bare `:set`, `:vault`, `:backup`, `:sessions`, `:sshkey` and `:token` open it at their part. `?` shows the keys and commands to start with, flagged in the keymap and the command table; a second `?` (or `:help all`) shows all of them, and a filter always searches all of them. Help rows are keyed by key and description, as two contexts can share a label.
This commit is contained in:
1 parent
d8e72c688d
commit
7f8d625a8d
34 files changed
+799
-457
No files matched your search
+28
-2
@@ -88,6 +88,21 @@ function commandSpecs(source: string): Spec[] {
|
||||
})
|
||||
}
|
||||
|
||||
/** The `renamed` table in commands.ts: an old spelling and the line it runs as now. */
|
||||
function renamedRows(source: string): string[] {
|
||||
const start = source.indexOf('const renamed: Record<')
|
||||
const block = source.slice(start, source.indexOf('\n}\n', start))
|
||||
const rows = [...block.matchAll(/^ '?([\w!]+)'?: '([^']+)',$/gm)].map(([, old, now]) => `| ${code(`:${old}`)} | ${code(`:${now}`)} |`)
|
||||
if (rows.length === 0) throw new Error('commands.ts: no renamed commands found')
|
||||
// The two that depend on where they are typed say so in their comment.
|
||||
return [
|
||||
...rows,
|
||||
`| ${code(':name!')} | ${code(':list name')} on the board, ${code(':space name')} elsewhere |`,
|
||||
`| ${code(':card!')} | ${code(':card')} while reading the document |`,
|
||||
`| ${code(':unmark')} | ${code('Esc')} in the list |`,
|
||||
]
|
||||
}
|
||||
|
||||
function commandsPage(): string {
|
||||
const help = read('web/src/lib/Help.svelte')
|
||||
const source = read('web/src/lib/commands.ts')
|
||||
@@ -144,10 +159,21 @@ ${keyTable('scratch')}
|
||||
|
||||
## Commands
|
||||
|
||||
A command takes a \`!\` for its forcing variant where one exists, the way vim's
|
||||
do: \`:w!\`, \`:space! <name>\`, \`:import!\`.
|
||||
A \`!\` means force, or everything, and nothing else: \`:w!\` writes over a
|
||||
newer version, \`:search!\` looks in every space, \`:export!\` downloads the
|
||||
whole workspace. A command that does a second thing takes a word for it:
|
||||
\`:space new <name>\`, \`:share off\`, \`:vault unlock\`.
|
||||
|
||||
${sections.join('\n\n')}
|
||||
|
||||
### Old spellings
|
||||
|
||||
These still work for one release, and run as the line beside them. Help and
|
||||
\`Tab\` no longer offer them.
|
||||
|
||||
| was | now |
|
||||
| --- | --- |
|
||||
${renamedRows(source).join('\n')}
|
||||
`
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user