@fnndsc/brasa 0.56.1 → 0.56.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildinfo.json +1 -1
- package/dist/builtins/berth/berth.d.ts +90 -3
- package/dist/builtins/berth/berth.js +129 -76
- package/dist/builtins/berth/berth.js.map +1 -1
- package/dist/builtins/berth/berthClose.d.ts +25 -6
- package/dist/builtins/berth/berthClose.js +8 -64
- package/dist/builtins/berth/berthClose.js.map +1 -1
- package/dist/builtins/berth/berthCube.d.ts +3 -2
- package/dist/builtins/berth/berthCube.js +9 -16
- package/dist/builtins/berth/berthCube.js.map +1 -1
- package/dist/builtins/berth/berthProcesses.js +33 -3
- package/dist/builtins/berth/berthProcesses.js.map +1 -1
- package/dist/builtins/debug.d.ts +24 -3
- package/dist/builtins/debug.js +66 -13
- package/dist/builtins/debug.js.map +1 -1
- package/dist/builtins/fs/acl.args.d.ts +5 -38
- package/dist/builtins/fs/acl.args.js +6 -72
- package/dist/builtins/fs/acl.args.js.map +1 -1
- package/dist/builtins/fs/acl.d.ts +100 -10
- package/dist/builtins/fs/acl.js +222 -68
- package/dist/builtins/fs/acl.js.map +1 -1
- package/dist/builtins/fs/cat.args.d.ts +14 -15
- package/dist/builtins/fs/cat.args.js +13 -40
- package/dist/builtins/fs/cat.args.js.map +1 -1
- package/dist/builtins/fs/cat.d.ts +40 -3
- package/dist/builtins/fs/cat.js +92 -13
- package/dist/builtins/fs/cat.js.map +1 -1
- package/dist/builtins/fs/cd.d.ts +24 -6
- package/dist/builtins/fs/cd.js +71 -18
- package/dist/builtins/fs/cd.js.map +1 -1
- package/dist/builtins/fs/configWrite.d.ts +24 -8
- package/dist/builtins/fs/configWrite.js +77 -36
- package/dist/builtins/fs/configWrite.js.map +1 -1
- package/dist/builtins/fs/cp.d.ts +39 -4
- package/dist/builtins/fs/cp.js +122 -56
- package/dist/builtins/fs/cp.js.map +1 -1
- package/dist/builtins/fs/download.d.ts +31 -4
- package/dist/builtins/fs/download.js +75 -38
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/du.d.ts +59 -33
- package/dist/builtins/fs/du.js +111 -79
- package/dist/builtins/fs/du.js.map +1 -1
- package/dist/builtins/fs/edit.d.ts +19 -4
- package/dist/builtins/fs/edit.js +77 -16
- package/dist/builtins/fs/edit.js.map +1 -1
- package/dist/builtins/fs/find.d.ts +25 -0
- package/dist/builtins/fs/find.js +76 -5
- package/dist/builtins/fs/find.js.map +1 -1
- package/dist/builtins/fs/ls.d.ts +69 -4
- package/dist/builtins/fs/ls.js +84 -45
- package/dist/builtins/fs/ls.js.map +1 -1
- package/dist/builtins/fs/mkdir.d.ts +28 -18
- package/dist/builtins/fs/mkdir.js +95 -66
- package/dist/builtins/fs/mkdir.js.map +1 -1
- package/dist/builtins/fs/mv.d.ts +34 -4
- package/dist/builtins/fs/mv.js +129 -64
- package/dist/builtins/fs/mv.js.map +1 -1
- package/dist/builtins/fs/pull.args.d.ts +56 -17
- package/dist/builtins/fs/pull.args.js +16 -66
- package/dist/builtins/fs/pull.args.js.map +1 -1
- package/dist/builtins/fs/pull.d.ts +62 -0
- package/dist/builtins/fs/pull.js +123 -31
- package/dist/builtins/fs/pull.js.map +1 -1
- package/dist/builtins/fs/pwd.d.ts +19 -5
- package/dist/builtins/fs/pwd.js +62 -8
- package/dist/builtins/fs/pwd.js.map +1 -1
- package/dist/builtins/fs/rm.d.ts +58 -21
- package/dist/builtins/fs/rm.js +99 -82
- package/dist/builtins/fs/rm.js.map +1 -1
- package/dist/builtins/fs/rmdir.d.ts +29 -11
- package/dist/builtins/fs/rmdir.js +87 -36
- package/dist/builtins/fs/rmdir.js.map +1 -1
- package/dist/builtins/fs/touch.d.ts +44 -9
- package/dist/builtins/fs/touch.js +91 -27
- package/dist/builtins/fs/touch.js.map +1 -1
- package/dist/builtins/fs/tree.d.ts +36 -9
- package/dist/builtins/fs/tree.js +126 -36
- package/dist/builtins/fs/tree.js.map +1 -1
- package/dist/builtins/fs/upload.d.ts +22 -3
- package/dist/builtins/fs/upload.js +82 -14
- package/dist/builtins/fs/upload.js.map +1 -1
- package/dist/builtins/fs/xattr.args.d.ts +12 -33
- package/dist/builtins/fs/xattr.args.js +17 -95
- package/dist/builtins/fs/xattr.args.js.map +1 -1
- package/dist/builtins/fs/xattr.d.ts +98 -8
- package/dist/builtins/fs/xattr.js +163 -24
- package/dist/builtins/fs/xattr.js.map +1 -1
- package/dist/builtins/games/bytes.d.ts +201 -5
- package/dist/builtins/games/bytes.js +255 -54
- package/dist/builtins/games/bytes.js.map +1 -1
- package/dist/builtins/games/chimes.d.ts +180 -3
- package/dist/builtins/games/chimes.js +203 -26
- package/dist/builtins/games/chimes.js.map +1 -1
- package/dist/builtins/games/chrislab.d.ts +101 -3
- package/dist/builtins/games/chrislab.js +117 -17
- package/dist/builtins/games/chrislab.js.map +1 -1
- package/dist/builtins/games/cowsay.d.ts +93 -2
- package/dist/builtins/games/cowsay.js +90 -31
- package/dist/builtins/games/cowsay.js.map +1 -1
- package/dist/builtins/games/figlet.d.ts +70 -2
- package/dist/builtins/games/figlet.js +83 -6
- package/dist/builtins/games/figlet.js.map +1 -1
- package/dist/builtins/games/lab.d.ts +104 -5
- package/dist/builtins/games/lab.js +144 -6
- package/dist/builtins/games/lab.js.map +1 -1
- package/dist/builtins/games/lolcat.d.ts +61 -1
- package/dist/builtins/games/lolcat.js +59 -24
- package/dist/builtins/games/lolcat.js.map +1 -1
- package/dist/builtins/games/morse.d.ts +36 -1
- package/dist/builtins/games/morse.js +50 -2
- package/dist/builtins/games/morse.js.map +1 -1
- package/dist/builtins/games/numbers.d.ts +241 -5
- package/dist/builtins/games/numbers.js +298 -23
- package/dist/builtins/games/numbers.js.map +1 -1
- package/dist/builtins/games/play.d.ts +96 -6
- package/dist/builtins/games/play.js +137 -6
- package/dist/builtins/games/play.js.map +1 -1
- package/dist/builtins/games/qr.d.ts +40 -1
- package/dist/builtins/games/qr.js +51 -2
- package/dist/builtins/games/qr.js.map +1 -1
- package/dist/builtins/games/show.d.ts +131 -6
- package/dist/builtins/games/show.js +208 -20
- package/dist/builtins/games/show.js.map +1 -1
- package/dist/builtins/games/sky.d.ts +178 -4
- package/dist/builtins/games/sky.js +228 -12
- package/dist/builtins/games/sky.js.map +1 -1
- package/dist/builtins/games/text.d.ts +258 -7
- package/dist/builtins/games/text.js +310 -29
- package/dist/builtins/games/text.js.map +1 -1
- package/dist/builtins/games/trek.d.ts +67 -3
- package/dist/builtins/games/trek.js +63 -10
- package/dist/builtins/games/trek.js.map +1 -1
- package/dist/builtins/games/wtf.d.ts +58 -1
- package/dist/builtins/games/wtf.js +67 -6
- package/dist/builtins/games/wtf.js.map +1 -1
- package/dist/builtins/help.d.ts +41 -3
- package/dist/builtins/help.js +92 -796
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/net/connect.d.ts +36 -3
- package/dist/builtins/net/connect.js +84 -26
- package/dist/builtins/net/connect.js.map +1 -1
- package/dist/builtins/net/cubepath.d.ts +49 -5
- package/dist/builtins/net/cubepath.js +69 -27
- package/dist/builtins/net/cubepath.js.map +1 -1
- package/dist/builtins/net/logout.d.ts +13 -4
- package/dist/builtins/net/logout.js +49 -3
- package/dist/builtins/net/logout.js.map +1 -1
- package/dist/builtins/net/netstat.d.ts +29 -4
- package/dist/builtins/net/netstat.js +64 -23
- package/dist/builtins/net/netstat.js.map +1 -1
- package/dist/builtins/net/pacs.d.ts +169 -15
- package/dist/builtins/net/pacs.js +92 -33
- package/dist/builtins/net/pacs.js.map +1 -1
- package/dist/builtins/net/query.args.d.ts +95 -0
- package/dist/builtins/net/query.args.js +26 -0
- package/dist/builtins/net/query.args.js.map +1 -0
- package/dist/builtins/net/query.d.ts +98 -5
- package/dist/builtins/net/query.js +89 -83
- package/dist/builtins/net/query.js.map +1 -1
- package/dist/builtins/net/status.d.ts +5 -3
- package/dist/builtins/net/status.js +5 -12
- package/dist/builtins/net/status.js.map +1 -1
- package/dist/builtins/parametersofplugin.d.ts +82 -3
- package/dist/builtins/parametersofplugin.js +79 -23
- package/dist/builtins/parametersofplugin.js.map +1 -1
- package/dist/builtins/proc.d.ts +210 -3
- package/dist/builtins/proc.js +210 -119
- package/dist/builtins/proc.js.map +1 -1
- package/dist/builtins/res/compute.d.ts +67 -3
- package/dist/builtins/res/compute.js +121 -35
- package/dist/builtins/res/compute.js.map +1 -1
- package/dist/builtins/res/dicom.d.ts +55 -7
- package/dist/builtins/res/dicom.js +86 -52
- package/dist/builtins/res/dicom.js.map +1 -1
- package/dist/builtins/res/expect.d.ts +52 -3
- package/dist/builtins/res/expect.js +92 -29
- package/dist/builtins/res/expect.js.map +1 -1
- package/dist/builtins/res/feed.d.ts +475 -3
- package/dist/builtins/res/feed.js +253 -158
- package/dist/builtins/res/feed.js.map +1 -1
- package/dist/builtins/res/files.d.ts +517 -3
- package/dist/builtins/res/files.js +124 -44
- package/dist/builtins/res/files.js.map +1 -1
- package/dist/builtins/res/gather.d.ts +113 -3
- package/dist/builtins/res/gather.js +153 -44
- package/dist/builtins/res/gather.js.map +1 -1
- package/dist/builtins/res/gather.process.d.ts +27 -19
- package/dist/builtins/res/gather.process.js +29 -59
- package/dist/builtins/res/gather.process.js.map +1 -1
- package/dist/builtins/res/group.d.ts +284 -3
- package/dist/builtins/res/group.js +147 -76
- package/dist/builtins/res/group.js.map +1 -1
- package/dist/builtins/res/image.d.ts +30 -2
- package/dist/builtins/res/image.js +62 -10
- package/dist/builtins/res/image.js.map +1 -1
- package/dist/builtins/res/play.d.ts +71 -9
- package/dist/builtins/res/play.js +124 -82
- package/dist/builtins/res/play.js.map +1 -1
- package/dist/builtins/res/plugininstance.d.ts +307 -2
- package/dist/builtins/res/plugininstance.js +122 -50
- package/dist/builtins/res/plugininstance.js.map +1 -1
- package/dist/builtins/res/pluginmeta.d.ts +244 -2
- package/dist/builtins/res/pluginmeta.js +98 -40
- package/dist/builtins/res/pluginmeta.js.map +1 -1
- package/dist/builtins/res/record.d.ts +37 -3
- package/dist/builtins/res/record.js +127 -57
- package/dist/builtins/res/record.js.map +1 -1
- package/dist/builtins/res/resourceList.d.ts +136 -0
- package/dist/builtins/res/resourceList.js +51 -0
- package/dist/builtins/res/resourceList.js.map +1 -0
- package/dist/builtins/res/tag.d.ts +244 -3
- package/dist/builtins/res/tag.js +97 -41
- package/dist/builtins/res/tag.js.map +1 -1
- package/dist/builtins/res/user.d.ts +122 -3
- package/dist/builtins/res/user.js +83 -21
- package/dist/builtins/res/user.js.map +1 -1
- package/dist/builtins/res/workflow.d.ts +244 -2
- package/dist/builtins/res/workflow.js +97 -40
- package/dist/builtins/res/workflow.js.map +1 -1
- package/dist/builtins/store.d.ts +85 -3
- package/dist/builtins/store.js +135 -68
- package/dist/builtins/store.js.map +1 -1
- package/dist/builtins/sys/apropos.d.ts +80 -5
- package/dist/builtins/sys/apropos.js +121 -15
- package/dist/builtins/sys/apropos.js.map +1 -1
- package/dist/builtins/sys/cal.d.ts +44 -5
- package/dist/builtins/sys/cal.js +57 -10
- package/dist/builtins/sys/cal.js.map +1 -1
- package/dist/builtins/sys/command.d.ts +20 -0
- package/dist/builtins/sys/command.js +31 -0
- package/dist/builtins/sys/command.js.map +1 -1
- package/dist/builtins/sys/context.d.ts +13 -3
- package/dist/builtins/sys/context.js +51 -4
- package/dist/builtins/sys/context.js.map +1 -1
- package/dist/builtins/sys/date.d.ts +56 -5
- package/dist/builtins/sys/date.js +63 -9
- package/dist/builtins/sys/date.js.map +1 -1
- package/dist/builtins/sys/echo.d.ts +63 -2
- package/dist/builtins/sys/echo.js +87 -8
- package/dist/builtins/sys/echo.js.map +1 -1
- package/dist/builtins/sys/fortune.d.ts +27 -2
- package/dist/builtins/sys/fortune.js +44 -2
- package/dist/builtins/sys/fortune.js.map +1 -1
- package/dist/builtins/sys/grep.d.ts +245 -11
- package/dist/builtins/sys/grep.js +418 -131
- package/dist/builtins/sys/grep.js.map +1 -1
- package/dist/builtins/sys/joblets.d.ts +66 -7
- package/dist/builtins/sys/joblets.js +101 -14
- package/dist/builtins/sys/joblets.js.map +1 -1
- package/dist/builtins/sys/motd.d.ts +37 -3
- package/dist/builtins/sys/motd.js +49 -8
- package/dist/builtins/sys/motd.js.map +1 -1
- package/dist/builtins/sys/notes.d.ts +75 -3
- package/dist/builtins/sys/notes.js +90 -29
- package/dist/builtins/sys/notes.js.map +1 -1
- package/dist/builtins/sys/physicalmode.d.ts +24 -3
- package/dist/builtins/sys/physicalmode.js +68 -14
- package/dist/builtins/sys/physicalmode.js.map +1 -1
- package/dist/builtins/sys/tasks.d.ts +74 -5
- package/dist/builtins/sys/tasks.js +102 -14
- package/dist/builtins/sys/tasks.js.map +1 -1
- package/dist/builtins/sys/textFilters.d.ts +673 -41
- package/dist/builtins/sys/textFilters.js +719 -264
- package/dist/builtins/sys/textFilters.js.map +1 -1
- package/dist/builtins/sys/timing.d.ts +24 -3
- package/dist/builtins/sys/timing.js +67 -14
- package/dist/builtins/sys/timing.js.map +1 -1
- package/dist/builtins/sys/variables.d.ts +70 -4
- package/dist/builtins/sys/variables.js +103 -31
- package/dist/builtins/sys/variables.js.map +1 -1
- package/dist/builtins/sys/version.d.ts +27 -2
- package/dist/builtins/sys/version.js +48 -3
- package/dist/builtins/sys/version.js.map +1 -1
- package/dist/builtins/sys/weather.d.ts +92 -15
- package/dist/builtins/sys/weather.js +71 -45
- package/dist/builtins/sys/weather.js.map +1 -1
- package/dist/builtins/sys/whoami.d.ts +38 -18
- package/dist/builtins/sys/whoami.js +112 -8
- package/dist/builtins/sys/whoami.js.map +1 -1
- package/dist/builtins/utils.d.ts +1 -38
- package/dist/builtins/utils.js +1 -87
- package/dist/builtins/utils.js.map +1 -1
- package/dist/chris/backend.js +2 -0
- package/dist/chris/backend.js.map +1 -1
- package/dist/chris/chrisCommands.js +62 -159
- package/dist/chris/chrisCommands.js.map +1 -1
- package/dist/chris/commandFallback.d.ts +12 -0
- package/dist/chris/commandFallback.js +47 -0
- package/dist/chris/commandFallback.js.map +1 -1
- package/dist/chris/files.js +24 -85
- package/dist/chris/files.js.map +1 -1
- package/dist/chris/filesystem.js +7 -5
- package/dist/chris/filesystem.js.map +1 -1
- package/dist/chris/help.js +0 -1082
- package/dist/chris/help.js.map +1 -1
- package/dist/chris/kinds.d.ts +30 -0
- package/dist/chris/kinds.js +154 -0
- package/dist/chris/kinds.js.map +1 -0
- package/dist/chris/mounts.d.ts +4 -4
- package/dist/chris/mounts.js +9 -16
- package/dist/chris/mounts.js.map +1 -1
- package/dist/chris/navigation.d.ts +2 -3
- package/dist/chris/navigation.js +6 -20
- package/dist/chris/navigation.js.map +1 -1
- package/dist/chris/pacsResources.d.ts +259 -0
- package/dist/chris/pacsResources.js +168 -0
- package/dist/chris/pacsResources.js.map +1 -0
- package/dist/chris/promptContext.d.ts +6 -0
- package/dist/chris/promptContext.js +3 -1
- package/dist/chris/promptContext.js.map +1 -1
- package/dist/core/argumentKinds.d.ts +107 -0
- package/dist/core/argumentKinds.js +223 -0
- package/dist/core/argumentKinds.js.map +1 -0
- package/dist/core/backend.d.ts +4 -1
- package/dist/core/backend.js.map +1 -1
- package/dist/core/commandDeclaration.d.ts +453 -0
- package/dist/core/commandDeclaration.js +52 -0
- package/dist/core/commandDeclaration.js.map +1 -0
- package/dist/core/commandParse.d.ts +64 -0
- package/dist/core/commandParse.js +468 -0
- package/dist/core/commandParse.js.map +1 -0
- package/dist/core/commandRegistry.d.ts +37 -0
- package/dist/core/commandRegistry.js +100 -3
- package/dist/core/commandRegistry.js.map +1 -1
- package/dist/core/commandSchema.d.ts +32 -0
- package/dist/core/commandSchema.js +117 -0
- package/dist/core/commandSchema.js.map +1 -0
- package/dist/core/commandUsage.d.ts +62 -0
- package/dist/core/commandUsage.js +247 -0
- package/dist/core/commandUsage.js.map +1 -0
- package/dist/core/coreCommands.js +66 -214
- package/dist/core/coreCommands.js.map +1 -1
- package/dist/core/dispatch.js +15 -8
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/paths.d.ts +51 -0
- package/dist/core/paths.js +86 -2
- package/dist/core/paths.js.map +1 -1
- package/dist/core/preprocess.d.ts +10 -9
- package/dist/core/preprocess.js +10 -20
- package/dist/core/preprocess.js.map +1 -1
- package/dist/core/warmupFailures.d.ts +34 -2
- package/dist/core/warmupFailures.js +43 -2
- package/dist/core/warmupFailures.js.map +1 -1
- package/dist/lib/completer/cfsPaths.d.ts +14 -0
- package/dist/lib/completer/cfsPaths.js +91 -0
- package/dist/lib/completer/cfsPaths.js.map +1 -0
- package/dist/lib/completer/declared.d.ts +15 -0
- package/dist/lib/completer/declared.js +189 -0
- package/dist/lib/completer/declared.js.map +1 -0
- package/dist/lib/completer/index.js +33 -79
- package/dist/lib/completer/index.js.map +1 -1
- package/dist/lib/parser.d.ts +5 -8
- package/dist/lib/parser.js +2 -11
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/vfs/vfs.d.ts +2 -1
- package/dist/lib/vfs/vfs.js +9 -6
- package/dist/lib/vfs/vfs.js.map +1 -1
- package/dist/lib/wildcard.js +2 -3
- package/dist/lib/wildcard.js.map +1 -1
- package/dist/notes.json +1 -1
- package/package.json +6 -5
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file
|
|
2
|
+
* @file `group` and `groups`: CUBE's groups, listed, searched, and their
|
|
3
|
+
* members listed, added and removed. Changing a membership needs an
|
|
4
|
+
* administrator (`sudo group adduser …`).
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* Declared in one record (`groupCommand`, `groups` among its aliases): the subcommands, their operands, and the listing options every
|
|
7
|
+
* resource command reads.
|
|
8
|
+
*
|
|
9
|
+
* Key components:
|
|
10
|
+
* - groupCommand: the declaration, answered as `group` and `groups`.
|
|
11
|
+
* - builtin_group: the declaration run over words already split.
|
|
12
|
+
* - groupSync_note: the caveat an add carries.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
7
15
|
*/
|
|
8
16
|
import chalk from 'chalk';
|
|
9
|
-
import { commandArgs_process, cliOptions_extract, resourceListOptions_refusal, resourceSearchTerm_refusal, resourceSearch_args } from '../utils.js';
|
|
10
17
|
import { groups_fetchList } from '@fnndsc/chili/commands/groups/list.js';
|
|
11
18
|
import { groupFields_fetch } from '@fnndsc/chili/commands/groups/fields.js';
|
|
12
19
|
import { groupMembers_fetch, groupReference_resolve, groupUser_add, groupUser_remove, } from '@fnndsc/chili/commands/groups/membership.js';
|
|
@@ -14,6 +21,9 @@ import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
|
14
21
|
import { authorizationFailure_is, sudoHint_build } from '../../core/elevation.js';
|
|
15
22
|
import { envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
16
23
|
import { exitCode_set } from '../../core/handlerRun.js';
|
|
24
|
+
import { command_declare } from '../../core/commandDeclaration.js';
|
|
25
|
+
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
26
|
+
import { RESOURCE_LIST_OPTIONS_GRAMMAR, resourceListBag_build } from './resourceList.js';
|
|
17
27
|
/**
|
|
18
28
|
* Renders an error for a failed group membership operation.
|
|
19
29
|
*
|
|
@@ -109,87 +119,148 @@ export function groupSync_note() {
|
|
|
109
119
|
return `${chalk.gray('Note: where CUBE takes its groups from a directory (Authentik, LDAP), a membership added here is undone at the user\'s next login; grant it in the directory to make it stick.')}\n`;
|
|
110
120
|
}
|
|
111
121
|
/**
|
|
112
|
-
*
|
|
122
|
+
* Lists the groups a listing's options ask for.
|
|
113
123
|
*
|
|
114
|
-
* @param
|
|
115
|
-
* @returns
|
|
124
|
+
* @param options - The bag chili's listing reads.
|
|
125
|
+
* @returns The table, or that there are none, or the error.
|
|
116
126
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (refusal !== null) {
|
|
123
|
-
exitCode_set(1);
|
|
124
|
-
return envelope_error('', undefined, `${chalk.red(refusal)}\n`);
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
const { groups, selectedFields, totalCount } = await groups_fetchList(cliOptions_extract(parsed));
|
|
128
|
-
if (groups.length === 0) {
|
|
129
|
-
return envelope_ok(`${chalk.gray('No groups found.')}\n`);
|
|
130
|
-
}
|
|
131
|
-
return envelope_ok(table_render(groups, selectedFields, { title: { title: 'Groups', justification: 'center' }, pagination: totalCount !== undefined ? { shown: groups.length, total: totalCount } : undefined }));
|
|
132
|
-
}
|
|
133
|
-
catch (e) {
|
|
134
|
-
exitCode_set(1);
|
|
135
|
-
return envelope_error('', undefined, `${chalk.red(`group error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
127
|
+
async function groupList_render(options) {
|
|
128
|
+
try {
|
|
129
|
+
const { groups, selectedFields, totalCount } = await groups_fetchList(options);
|
|
130
|
+
if (groups.length === 0) {
|
|
131
|
+
return envelope_ok(`${chalk.gray('No groups found.')}\n`);
|
|
136
132
|
}
|
|
133
|
+
return envelope_ok(table_render(groups, selectedFields, { title: { title: 'Groups', justification: 'center' }, pagination: totalCount !== undefined ? { shown: groups.length, total: totalCount } : undefined }));
|
|
137
134
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
exitCode_set(1);
|
|
142
|
-
return envelope_error('', undefined, `${chalk.red(refusal)}\n`);
|
|
143
|
-
}
|
|
144
|
-
const query = String(parsed._[1]);
|
|
145
|
-
const search = query.includes(':') ? query : `name_icontains:${query}`;
|
|
146
|
-
return builtin_group(resourceSearch_args(parsed, search));
|
|
147
|
-
}
|
|
148
|
-
if (subcommand === 'inspect') {
|
|
149
|
-
const reference = parsed._[1];
|
|
150
|
-
if (reference !== undefined) {
|
|
151
|
-
const resolved = await groupReference_resolve(reference);
|
|
152
|
-
if (!resolved.ok)
|
|
153
|
-
return group_error(resolved.error);
|
|
154
|
-
return envelope_ok(table_render([{ id: resolved.value.id, name: resolved.value.name }], ['id', 'name'], { title: { title: `Group ${group_label(resolved.value)}`, justification: 'center' } }));
|
|
155
|
-
}
|
|
156
|
-
const fields = await groupFields_fetch();
|
|
157
|
-
if (fields && fields.length > 0) {
|
|
158
|
-
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Group fields', justification: 'center' } }));
|
|
159
|
-
}
|
|
160
|
-
return envelope_ok(`${chalk.gray('No fields found for groups.')}\n`);
|
|
135
|
+
catch (e) {
|
|
136
|
+
exitCode_set(1);
|
|
137
|
+
return envelope_error('', undefined, `${chalk.red(`group error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
161
138
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* `group inspect [<group>]`: one group's identity, or the fields a group has.
|
|
142
|
+
*
|
|
143
|
+
* @param reference - The group's name or id, or none for the fields.
|
|
144
|
+
* @returns The identity or the fields, or the error.
|
|
145
|
+
*/
|
|
146
|
+
async function groupInspect_render(reference) {
|
|
147
|
+
if (reference !== undefined) {
|
|
166
148
|
const resolved = await groupReference_resolve(reference);
|
|
167
149
|
if (!resolved.ok)
|
|
168
150
|
return group_error(resolved.error);
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
151
|
+
return envelope_ok(table_render([{ id: resolved.value.id, name: resolved.value.name }], ['id', 'name'], { title: { title: `Group ${group_label(resolved.value)}`, justification: 'center' } }));
|
|
152
|
+
}
|
|
153
|
+
const fields = await groupFields_fetch();
|
|
154
|
+
if (fields && fields.length > 0) {
|
|
155
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Group fields', justification: 'center' } }));
|
|
156
|
+
}
|
|
157
|
+
return envelope_ok(`${chalk.gray('No fields found for groups.')}\n`);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* `group members <group>`: the users in one group.
|
|
161
|
+
*
|
|
162
|
+
* @param reference - The group's name or id.
|
|
163
|
+
* @returns The members' table, or that it has none, or the error.
|
|
164
|
+
*/
|
|
165
|
+
async function groupMembers_render(reference) {
|
|
166
|
+
const resolved = await groupReference_resolve(reference);
|
|
167
|
+
if (!resolved.ok)
|
|
168
|
+
return group_error(resolved.error);
|
|
169
|
+
const result = await groupMembers_fetch(resolved.value.id);
|
|
170
|
+
if (!result.ok)
|
|
171
|
+
return group_error(result.error);
|
|
172
|
+
if (result.value.length === 0) {
|
|
173
|
+
return envelope_ok(`${chalk.gray(`Group ${group_label(resolved.value)} has no users.`)}\n`);
|
|
180
174
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
175
|
+
const rows = result.value.map((member) => ({
|
|
176
|
+
id: member.id,
|
|
177
|
+
username: member.username,
|
|
178
|
+
}));
|
|
179
|
+
return envelope_ok(table_render(rows, ['id', 'username'], { title: { title: `Group ${group_label(resolved.value)} users`, justification: 'center' } }));
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* `group adduser|removeuser <group> <user…>`: one membership change for
|
|
183
|
+
* every user named.
|
|
184
|
+
*
|
|
185
|
+
* @param reference - The group's name or id.
|
|
186
|
+
* @param usernames - The users, in the order given.
|
|
187
|
+
* @param operation - Whether they are added or removed.
|
|
188
|
+
* @returns The batch's outcome, or the error.
|
|
189
|
+
*/
|
|
190
|
+
async function groupMembership_change(reference, usernames, operation) {
|
|
191
|
+
const resolved = await groupReference_resolve(reference);
|
|
192
|
+
if (!resolved.ok)
|
|
193
|
+
return group_error(resolved.error);
|
|
194
|
+
return groupMembership_batch(resolved.value, usernames, operation);
|
|
195
|
+
}
|
|
196
|
+
/** What a `group` line may hold. */
|
|
197
|
+
const GROUP_GRAMMAR = {
|
|
198
|
+
bare: { summary: 'List the groups, as list does', options: RESOURCE_LIST_OPTIONS_GRAMMAR },
|
|
199
|
+
subcommands: {
|
|
200
|
+
list: { summary: 'List the groups, 20 to a page', options: RESOURCE_LIST_OPTIONS_GRAMMAR },
|
|
201
|
+
search: {
|
|
202
|
+
summary: 'List the groups a filter matches: field:value, or a name fragment (list --search <term>)',
|
|
203
|
+
operands: [{ name: 'term', kind: 'word', summary: 'The filter, field:value, or part of a name' }],
|
|
204
|
+
options: RESOURCE_LIST_OPTIONS_GRAMMAR,
|
|
205
|
+
},
|
|
206
|
+
inspect: { summary: "One group's name and id, or, with none named, the fields a group has", operands: [{ name: 'group', kind: 'word', optional: true, summary: "The group's name or id" }] },
|
|
207
|
+
members: { summary: 'List the users in a group', operands: [{ name: 'group', kind: 'word', summary: "The group's name or id" }] },
|
|
208
|
+
adduser: { summary: 'Add users to a group (an administrator: sudo group adduser …)', operands: [{ name: 'group', kind: 'word', summary: "The group's name or id" }, { name: 'users', kind: 'word', repeat: true, summary: 'The usernames' }] },
|
|
209
|
+
removeuser: { summary: 'Remove users from a group (an administrator: sudo group removeuser …)', operands: [{ name: 'group', kind: 'word', summary: "The group's name or id" }, { name: 'users', kind: 'word', repeat: true, summary: 'The usernames' }] },
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Runs one `group` line.
|
|
214
|
+
*
|
|
215
|
+
* @param args - The line, parsed.
|
|
216
|
+
* @returns The listing, the group, its members, or what a change did.
|
|
217
|
+
*/
|
|
218
|
+
async function group_run(args) {
|
|
219
|
+
switch (args.subcommand) {
|
|
220
|
+
case null:
|
|
221
|
+
case 'list': return groupList_render(resourceListBag_build(args.options));
|
|
222
|
+
case 'search': {
|
|
223
|
+
const term = args.operands.term;
|
|
224
|
+
return groupList_render(resourceListBag_build(args.options, term.includes(':') ? term : `name_icontains:${term}`));
|
|
186
225
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return
|
|
226
|
+
case 'inspect': return groupInspect_render(args.operands.group);
|
|
227
|
+
case 'members': return groupMembers_render(args.operands.group);
|
|
228
|
+
case 'adduser': return groupMembership_change(args.operands.group, args.operands.users, 'add');
|
|
229
|
+
case 'removeuser': return groupMembership_change(args.operands.group, args.operands.users, 'remove');
|
|
191
230
|
}
|
|
192
|
-
|
|
193
|
-
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* `group [list | search <term> | inspect [group] | members <group> | adduser|removeuser <group> <user…>]`: the declaration.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* commands_register({ declarations: [groupCommand] }, 'backend');
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
export const groupCommand = command_declare({
|
|
241
|
+
name: 'group',
|
|
242
|
+
aliases: [{ name: 'groups', holds: [] }],
|
|
243
|
+
grammar: GROUP_GRAMMAR,
|
|
244
|
+
help: {
|
|
245
|
+
summary: "CUBE's groups: list them, search them, list and change their members",
|
|
246
|
+
description: "List the groups in CUBE, a page at a time or every page, filtered by a search (field:value, or part of a name) and in the columns asked for; inspect names one group's id, or the fields a group has. members lists a group's users; adduser and removeuser change them, each user in turn, and need an administrator (sudo group adduser …). Where CUBE takes its groups from a directory (Authentik, LDAP), a membership added here is undone at the user's next login. group and groups are one command.",
|
|
247
|
+
category: 'Resources',
|
|
248
|
+
examples: ['groups list', 'groups search pacs', 'group inspect pacs_users', 'group members pacs_users', 'sudo group adduser pacs_users peter.hong joe.schmo', 'sudo group removeuser pacs_users joe.schmo'],
|
|
249
|
+
},
|
|
250
|
+
handler: group_run,
|
|
251
|
+
});
|
|
252
|
+
/**
|
|
253
|
+
* `group` over words already split: the declaration's parse and handler.
|
|
254
|
+
*
|
|
255
|
+
* @param args - The words after `group`.
|
|
256
|
+
* @returns The answer, or the refusal of a bad line.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```ts
|
|
260
|
+
* await builtin_group(['members', 'pacs_users']);
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
export async function builtin_group(args) {
|
|
264
|
+
return declaredCommand_run(groupCommand, args);
|
|
194
265
|
}
|
|
195
266
|
//# sourceMappingURL=group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/builtins/res/group.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/builtins/res/group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAmB,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EAEtB,aAAa,EACb,gBAAgB,GAGjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAmB,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAA8C,MAAM,kCAAkC,CAAC;AAC/G,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEzF;;;;;GAKG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,YAAY,CAAC,CAAC,CAAC,CAAC;IAChB,OAAO,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,KAAqB;IACxC,OAAO,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,EAAE,GAAG,CAAC;AACvC,CAAC;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,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACxC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE;QACJ,OAAO,EAAE,sEAAsE;QAC/E,WAAW,EAAE,6eAA6e;QAC1f,QAAQ,EAAE,WAAW;QACrB,QAAQ,EAAE,CAAC,aAAa,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,oDAAoD,EAAE,4CAA4C,CAAC;KAC5M;IACD,OAAO,EAAE,SAAS;CACnB,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAc;IAChD,OAAO,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,8 +1,36 @@
|
|
|
1
1
|
import { type CommandEnvelope } from '@fnndsc/menu';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* `image [--force] [path]`: the declaration. Given no path, it shows its help.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* commands_register({ declarations: [imageCommand] }, 'backend');
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare const imageCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
11
|
+
readonly operands: readonly [{
|
|
12
|
+
readonly name: "path";
|
|
13
|
+
readonly kind: "cfsPath";
|
|
14
|
+
readonly optional: true;
|
|
15
|
+
readonly glob: true;
|
|
16
|
+
readonly summary: "A series folder, a .dcm file (its folder is the series), or a NIfTI/MGZ volume";
|
|
17
|
+
}];
|
|
18
|
+
readonly options: {
|
|
19
|
+
readonly force: {
|
|
20
|
+
readonly long: "force";
|
|
21
|
+
readonly summary: "Ride through the volume-size guard a graphical surface would hold at";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* `image` over words already split: the declaration's parse and handler.
|
|
4
27
|
*
|
|
5
28
|
* @param args - The command arguments.
|
|
6
|
-
* @returns An envelope carrying the reflection text and the `image.view` intent.
|
|
29
|
+
* @returns An envelope carrying the reflection text and the `image.view` intent, or the refusal of a bad line.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* await builtin_image(['--force', 'brain.nii.gz']);
|
|
34
|
+
* ```
|
|
7
35
|
*/
|
|
8
36
|
export declare function builtin_image(args: string[]): Promise<CommandEnvelope>;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* The path resolves to a series (via the same reader `dcm series` uses) or a
|
|
15
15
|
* volume file; anything else is refused by name. `--force` rides through the
|
|
16
|
-
* volume-size guard a graphical surface would otherwise hold at.
|
|
16
|
+
* volume-size guard a graphical surface would otherwise hold at. The line is
|
|
17
|
+
* declared in one record (`imageCommand`).
|
|
17
18
|
*
|
|
18
19
|
* A stop is honoured between the reads: after the path resolves, after the
|
|
19
20
|
* series' listing and header, and before the thumbnail's slice. A read
|
|
@@ -24,8 +25,10 @@
|
|
|
24
25
|
import { context_getSingle, dicomSeries_summarize, dicomSlice_gray } from '@fnndsc/salsa';
|
|
25
26
|
import { IMAGE_MODEL_KINDS, envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
26
27
|
import chalk from 'chalk';
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
28
|
+
import { path_resolve } from '../utils.js';
|
|
29
|
+
import { help_render } from '../help.js';
|
|
30
|
+
import { command_declare } from '../../core/commandDeclaration.js';
|
|
31
|
+
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
29
32
|
import { surface_get } from '../../core/surface.js';
|
|
30
33
|
import { series_render } from './dicom.js';
|
|
31
34
|
import { thumbnail_render } from './thumbnail.js';
|
|
@@ -43,20 +46,69 @@ const DICOM_FILE_PATTERN = /\.dcm$/i;
|
|
|
43
46
|
function stopped_answer() {
|
|
44
47
|
return envelope_error('', undefined, 'image: stopped\n');
|
|
45
48
|
}
|
|
49
|
+
/** What an `image` line may hold. */
|
|
50
|
+
const IMAGE_GRAMMAR = {
|
|
51
|
+
operands: [{ name: 'path', kind: 'cfsPath', optional: true, glob: true, summary: 'A series folder, a .dcm file (its folder is the series), or a NIfTI/MGZ volume' }],
|
|
52
|
+
options: {
|
|
53
|
+
force: { long: 'force', summary: 'Ride through the volume-size guard a graphical surface would hold at' },
|
|
54
|
+
},
|
|
55
|
+
};
|
|
46
56
|
/**
|
|
47
|
-
*
|
|
57
|
+
* `image [--force] [path]`: the declaration. Given no path, it shows its help.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* commands_register({ declarations: [imageCommand] }, 'backend');
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export const imageCommand = command_declare({
|
|
65
|
+
name: 'image',
|
|
66
|
+
grammar: IMAGE_GRAMMAR,
|
|
67
|
+
help: {
|
|
68
|
+
summary: 'Show a DICOM series or a volume — a browser draws it, a terminal reflects it',
|
|
69
|
+
description: 'Open an image as the kernel sees it. `image <path>` resolves what the path is — a series '
|
|
70
|
+
+ 'folder, a `.dcm` file (its folder is the series), or a NIfTI/MGZ volume — and emits an image.view '
|
|
71
|
+
+ 'intent every attached surface renders in its own way: a graphical surface (ARGUS) opens a rendered '
|
|
72
|
+
+ 'pane; a text surface (a shared TTY) prints a reflection — the same facts `dcm series` shows, under an '
|
|
73
|
+
+ '`image` line, with a small ASCII or truecolour thumbnail of the middle slice. So the same `image` line '
|
|
74
|
+
+ 'works from a browser and from a terminal sharing one CALYPSO session.',
|
|
75
|
+
category: 'Imaging',
|
|
76
|
+
examples: [
|
|
77
|
+
'image ~/uploads/sag-anon # A series folder',
|
|
78
|
+
'image /SERVICES/PACS/PACSDCM/patient/study/00005-T1-abcdef0',
|
|
79
|
+
'image scan.dcm # A single file; its folder is the series',
|
|
80
|
+
'image brain.nii.gz --force # A volume, past the size guard',
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
// `image` answers with an intent a surface draws, and changes nothing of the session.
|
|
84
|
+
holds: [],
|
|
85
|
+
handler: (args) => image_run(args.operands.path, args.options.force),
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* `image` over words already split: the declaration's parse and handler.
|
|
48
89
|
*
|
|
49
90
|
* @param args - The command arguments.
|
|
50
|
-
* @returns An envelope carrying the reflection text and the `image.view` intent.
|
|
91
|
+
* @returns An envelope carrying the reflection text and the `image.view` intent, or the refusal of a bad line.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* await builtin_image(['--force', 'brain.nii.gz']);
|
|
96
|
+
* ```
|
|
51
97
|
*/
|
|
52
98
|
export async function builtin_image(args) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
99
|
+
return declaredCommand_run(imageCommand, args);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Shows the image a path names: a volume's intent, or a series' reflection
|
|
103
|
+
* and intent; its help when no path is given.
|
|
104
|
+
*
|
|
105
|
+
* @param target - The path, or undefined.
|
|
106
|
+
* @param force - Ride through a surface's volume-size guard.
|
|
107
|
+
* @returns An envelope carrying the reflection text and the `image.view` intent.
|
|
108
|
+
*/
|
|
109
|
+
async function image_run(target, force) {
|
|
57
110
|
if (target === undefined)
|
|
58
111
|
return envelope_ok(help_render('image'));
|
|
59
|
-
const force = parsed.force === true;
|
|
60
112
|
commandCancellation_enable();
|
|
61
113
|
const signal = commandCancellation_signalGet();
|
|
62
114
|
// Read afresh at each step: the signal changes while a read is awaited.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/builtins/res/image.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/builtins/res/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GA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AAwE;AACxE,KAAK,UAAU,kBAAkB;IAC/B,MAAM,IAAI,GAAkB,CAAC,MAAM,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC;IAC7D,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,IAAI,cAAc,CAAC;AACjE,CAAC"}
|
|
@@ -70,21 +70,83 @@ interface PlayArgs {
|
|
|
70
70
|
parseError: string | null;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* `play <manifest> [--param NAME=value]… [--pace <duration>] [--dry-run] [--status [--text <script>]]`: the declaration.
|
|
74
74
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* commands_register({ declarations: [playCommand] });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare const playCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
81
|
+
readonly operands: readonly [{
|
|
82
|
+
readonly name: "manifest";
|
|
83
|
+
readonly kind: "cfsPath";
|
|
84
|
+
readonly glob: true;
|
|
85
|
+
readonly summary: "The manifest: read from the session's filesystem first, the engine's disk second";
|
|
86
|
+
}];
|
|
87
|
+
readonly options: {
|
|
88
|
+
readonly param: {
|
|
89
|
+
readonly long: "param";
|
|
90
|
+
readonly repeat: true;
|
|
91
|
+
readonly summary: "Supply a parameter the manifest declares (repeatable)";
|
|
92
|
+
readonly value: {
|
|
93
|
+
readonly name: "NAME=value";
|
|
94
|
+
readonly kind: "word";
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
readonly pace: {
|
|
98
|
+
readonly long: "pace";
|
|
99
|
+
readonly summary: "Wait between lines, for watching a play at a surface";
|
|
100
|
+
readonly value: {
|
|
101
|
+
readonly name: "duration";
|
|
102
|
+
readonly kind: "word";
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
readonly dryRun: {
|
|
106
|
+
readonly long: "dry-run";
|
|
107
|
+
readonly summary: "Expand the lines and show them without running any";
|
|
108
|
+
};
|
|
109
|
+
readonly status: {
|
|
110
|
+
readonly long: "status";
|
|
111
|
+
readonly summary: "Run nothing: say where each line stands, from what the backend keeps";
|
|
112
|
+
};
|
|
113
|
+
readonly text: {
|
|
114
|
+
readonly long: "text";
|
|
115
|
+
readonly summary: "With --status: the script's text, read in place of the file's";
|
|
116
|
+
readonly value: {
|
|
117
|
+
readonly name: "script";
|
|
118
|
+
readonly kind: "word";
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
readonly step: {
|
|
122
|
+
readonly long: "step";
|
|
123
|
+
readonly summary: "Refused: a keypress needs a terminal; at a surface, play with --pace";
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Reads `play`'s own words as its declaration parses them, with the checks
|
|
129
|
+
* the parse cannot make: the request a line makes, or why it makes none.
|
|
78
130
|
*
|
|
79
|
-
* @param args - The
|
|
80
|
-
* @returns What was asked for.
|
|
131
|
+
* @param args - The words after `play`, as literals.
|
|
132
|
+
* @returns What was asked for; `parseError` holds a refusal, the parser's or a check's.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* (await playArgs_parse(['f.mise', '--param', 'MRN=1'])).params.get('MRN'); // '1'
|
|
137
|
+
* ```
|
|
81
138
|
*/
|
|
82
|
-
export declare function playArgs_parse(args: string[]): PlayArgs
|
|
139
|
+
export declare function playArgs_parse(args: string[]): Promise<PlayArgs>;
|
|
83
140
|
/**
|
|
84
|
-
*
|
|
141
|
+
* `play` over words already split: the declaration's parse and handler.
|
|
85
142
|
*
|
|
86
|
-
* @param args -
|
|
143
|
+
* @param args - The words after `play`.
|
|
87
144
|
* @returns An envelope carrying what the play did, or the refusal that stopped it.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* await builtin_play(['~/flows/battery.mise', '--dry-run']);
|
|
149
|
+
* ```
|
|
88
150
|
*/
|
|
89
151
|
export declare function builtin_play(args: string[]): Promise<CommandEnvelope>;
|
|
90
152
|
export {};
|