@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,16 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file
|
|
2
|
+
* @file `plugininstance` and its other names (`plugininstances`, `instance`,
|
|
3
|
+
* `instances`, `job`, `jobs`): CUBE's plugin instances, the jobs, listed,
|
|
4
|
+
* searched, and their fields named. A job is worked where it lives, in
|
|
5
|
+
* /proc/jobs; the verbs that would do it here say how instead.
|
|
3
6
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
7
|
+
* Declared in one record (`plugininstanceCommand`, its other names as aliases): the
|
|
8
|
+
* subcommands and the listing options every resource command reads.
|
|
9
|
+
*
|
|
10
|
+
* Key components:
|
|
11
|
+
* - plugininstanceCommand: the declaration, answered under each of its names.
|
|
12
|
+
* - builtin_plugininstance: the declaration run over words already split.
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
6
15
|
*/
|
|
7
16
|
import chalk from 'chalk';
|
|
8
|
-
import { commandArgs_process, cliOptions_extract, resourceListOptions_refusal, resourceSearchTerm_refusal, resourceSearch_args } from '../utils.js';
|
|
9
17
|
import { pluginInstances_fetchList } from '@fnndsc/chili/commands/plugininstances/list.js';
|
|
10
18
|
import { pluginInstanceFields_fetch } from '@fnndsc/chili/commands/plugininstances/fields.js';
|
|
11
19
|
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
12
20
|
import { envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
13
21
|
import { exitCode_set } from '../../core/handlerRun.js';
|
|
22
|
+
import { command_declare } from '../../core/commandDeclaration.js';
|
|
23
|
+
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
24
|
+
import { RESOURCE_LIST_OPTIONS_GRAMMAR, resourceListBag_build } from './resourceList.js';
|
|
14
25
|
/**
|
|
15
26
|
* Projects a listed row onto the wire's instance model: the fields the
|
|
16
27
|
* listing selected, typed; a field the listing did not select is absent.
|
|
@@ -54,58 +65,119 @@ const PROC_WAYS = {
|
|
|
54
65
|
log: '`cat <path>/log` is its log',
|
|
55
66
|
};
|
|
56
67
|
/**
|
|
57
|
-
*
|
|
68
|
+
* Lists the plugin instances a listing's options ask for, as a table and as
|
|
69
|
+
* the run history a surface reads (a catalogue's RECENT block) rather than scrapes.
|
|
58
70
|
*
|
|
59
|
-
* @param
|
|
71
|
+
* @param options - The bag chili's listing reads.
|
|
72
|
+
* @returns The table and model, or that there are none, or the error.
|
|
60
73
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
exitCode_set(1);
|
|
68
|
-
return envelope_error('', undefined, `${chalk.red(refusal)}\n`);
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const { pluginInstances, selectedFields, totalCount } = await pluginInstances_fetchList(cliOptions_extract(parsed));
|
|
72
|
-
// The listing is a model as well as a table: the run history a surface
|
|
73
|
-
// reads (a catalogue's RECENT block) rather than scrapes.
|
|
74
|
-
const model = { kind: 'plugininstance.list', data: pluginInstances.map(instanceRow_project) };
|
|
75
|
-
if (pluginInstances.length === 0) {
|
|
76
|
-
return envelope_ok(`${chalk.gray('No plugin instances found.')}\n`, model);
|
|
77
|
-
}
|
|
78
|
-
return envelope_ok(table_render(pluginInstances, selectedFields, { title: { title: 'Plugin Instances', justification: 'center' }, pagination: totalCount !== undefined ? { shown: pluginInstances.length, total: totalCount } : undefined }), model);
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
exitCode_set(1);
|
|
82
|
-
return envelope_error('', undefined, `${chalk.red(`plugininstance error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (subcommand === 'search') {
|
|
86
|
-
const refusal = resourceSearchTerm_refusal('plugininstance', parsed);
|
|
87
|
-
if (refusal !== null) {
|
|
88
|
-
exitCode_set(1);
|
|
89
|
-
return envelope_error('', undefined, `${chalk.red(refusal)}\n`);
|
|
90
|
-
}
|
|
91
|
-
return builtin_plugininstance(resourceSearch_args(parsed));
|
|
92
|
-
}
|
|
93
|
-
if (subcommand === 'inspect') {
|
|
94
|
-
const fields = await pluginInstanceFields_fetch();
|
|
95
|
-
if (fields && fields.length > 0) {
|
|
96
|
-
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Plugin Instance fields', justification: 'center' } }));
|
|
74
|
+
async function plugininstanceList_render(options) {
|
|
75
|
+
try {
|
|
76
|
+
const { pluginInstances, selectedFields, totalCount } = await pluginInstances_fetchList(options);
|
|
77
|
+
const model = { kind: 'plugininstance.list', data: pluginInstances.map(instanceRow_project) };
|
|
78
|
+
if (pluginInstances.length === 0) {
|
|
79
|
+
return envelope_ok(`${chalk.gray('No plugin instances found.')}\n`, model);
|
|
97
80
|
}
|
|
98
|
-
return envelope_ok(
|
|
81
|
+
return envelope_ok(table_render(pluginInstances, selectedFields, { title: { title: 'Plugin Instances', justification: 'center' }, pagination: totalCount !== undefined ? { shown: pluginInstances.length, total: totalCount } : undefined }), model);
|
|
99
82
|
}
|
|
100
|
-
|
|
101
|
-
// rather than keep a second way to do what the tree already does.
|
|
102
|
-
const where = PROC_WAYS[subcommand];
|
|
103
|
-
if (where !== undefined) {
|
|
104
|
-
const id = String(parsed._[1] ?? '<id>');
|
|
83
|
+
catch (e) {
|
|
105
84
|
exitCode_set(1);
|
|
106
|
-
return envelope_error('', undefined, `${chalk.red(`plugininstance
|
|
85
|
+
return envelope_error('', undefined, `${chalk.red(`plugininstance error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
107
86
|
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Names the fields a plugin instance has.
|
|
90
|
+
*
|
|
91
|
+
* @returns The fields' table, or that there are none.
|
|
92
|
+
*/
|
|
93
|
+
async function plugininstanceFields_render() {
|
|
94
|
+
const fields = await pluginInstanceFields_fetch();
|
|
95
|
+
if (fields && fields.length > 0) {
|
|
96
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Plugin Instance fields', justification: 'center' } }));
|
|
97
|
+
}
|
|
98
|
+
return envelope_ok(`${chalk.gray('No fields found for plugin instances.')}\n`);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A job verb the tree already answers: names the /proc/jobs path and what to
|
|
102
|
+
* do there, rather than keep a second way to do what the tree does.
|
|
103
|
+
*
|
|
104
|
+
* @param verb - The verb asked for.
|
|
105
|
+
* @param id - The job's id as typed, if any.
|
|
106
|
+
* @returns The refusal that says how.
|
|
107
|
+
*/
|
|
108
|
+
function procWay_say(verb, id) {
|
|
108
109
|
exitCode_set(1);
|
|
109
|
-
return envelope_error(`${chalk.red(`
|
|
110
|
+
return envelope_error('', undefined, `${chalk.red(`plugininstance ${verb}: a job is worked in /proc/jobs; \`proc find ${id ?? '<id>'}\` names its path, then ${PROC_WAYS[verb]}`)}\n`);
|
|
111
|
+
}
|
|
112
|
+
/** The operand of a job verb /proc/jobs answers: the job's id, which it names in the way it says. */
|
|
113
|
+
const JOB_ID_OPERANDS = [{ name: 'id', kind: 'word', optional: true, summary: "The job's id" }];
|
|
114
|
+
/** What a `plugininstance` line may hold. */
|
|
115
|
+
const PLUGININSTANCE_GRAMMAR = {
|
|
116
|
+
bare: { summary: 'List the plugin instances, as list does', options: RESOURCE_LIST_OPTIONS_GRAMMAR },
|
|
117
|
+
subcommands: {
|
|
118
|
+
list: { summary: 'List the plugin instances, 20 to a page', options: RESOURCE_LIST_OPTIONS_GRAMMAR },
|
|
119
|
+
search: {
|
|
120
|
+
summary: 'List the plugin instances a filter matches (list --search <term>)',
|
|
121
|
+
operands: [{ name: 'term', kind: 'word', summary: 'The filter, field:value (inspect names the fields)' }],
|
|
122
|
+
options: RESOURCE_LIST_OPTIONS_GRAMMAR,
|
|
123
|
+
},
|
|
124
|
+
inspect: { summary: 'Name the fields a plugin instance has' },
|
|
125
|
+
cancel: { summary: 'Says how: rm <path> in /proc/jobs cancels a running job', operands: JOB_ID_OPERANDS },
|
|
126
|
+
delete: { summary: 'Says how: rm <path> in /proc/jobs removes a finished job', operands: JOB_ID_OPERANDS },
|
|
127
|
+
rm: { summary: 'Says how: rm <path> in /proc/jobs removes a finished job', operands: JOB_ID_OPERANDS },
|
|
128
|
+
output: { summary: 'Says how: <path>/data in /proc/jobs is its output folder', operands: JOB_ID_OPERANDS },
|
|
129
|
+
parameters: { summary: 'Says how: cat <path>/params in /proc/jobs lists its parameters', operands: JOB_ID_OPERANDS },
|
|
130
|
+
params: { summary: 'Says how: cat <path>/params in /proc/jobs lists its parameters', operands: JOB_ID_OPERANDS },
|
|
131
|
+
log: { summary: 'Says how: cat <path>/log in /proc/jobs is its log', operands: JOB_ID_OPERANDS },
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Runs one `plugininstance` line.
|
|
136
|
+
*
|
|
137
|
+
* @param args - The line, parsed.
|
|
138
|
+
* @returns The listing, the fields, or the way /proc/jobs does it.
|
|
139
|
+
*/
|
|
140
|
+
async function plugininstance_run(args) {
|
|
141
|
+
switch (args.subcommand) {
|
|
142
|
+
case null:
|
|
143
|
+
case 'list': return plugininstanceList_render(resourceListBag_build(args.options));
|
|
144
|
+
case 'search': return plugininstanceList_render(resourceListBag_build(args.options, args.operands.term));
|
|
145
|
+
case 'inspect': return plugininstanceFields_render();
|
|
146
|
+
default: return procWay_say(args.subcommand, args.operands.id);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* `plugininstance [[listing options] | list [listing options] | search <term> [listing options] | inspect | <job verb> [id]]`: the declaration.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* commands_register({ declarations: [plugininstanceCommand] }, 'backend');
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export const plugininstanceCommand = command_declare({
|
|
158
|
+
name: 'plugininstance',
|
|
159
|
+
aliases: [{ name: 'plugininstances', holds: [] }, 'instance', 'instances', 'job', 'jobs'],
|
|
160
|
+
grammar: PLUGININSTANCE_GRAMMAR,
|
|
161
|
+
help: {
|
|
162
|
+
summary: "CUBE's plugin instances, the jobs: list them, search them, name their fields",
|
|
163
|
+
description: 'List the plugin instances in CUBE, the jobs, a page at a time or every page, filtered by a field:value search and in the columns asked for; inspect names the fields a job has. A job is worked in /proc/jobs: proc find <id> names its path, rm <path> cancels it while it runs and removes it once done, cat <path>/params and cat <path>/log read it, and <path>/data is its output; the verbs that would do these here say so. plugininstance, plugininstances, instance, instances, job and jobs are one command.',
|
|
164
|
+
category: 'Resources',
|
|
165
|
+
examples: ['jobs list', 'jobs list --all', 'jobs search status:started', 'jobs list --search feed_id:5536', 'jobs inspect', 'proc find 42'],
|
|
166
|
+
},
|
|
167
|
+
handler: plugininstance_run,
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* `plugininstance` over words already split: the declaration's parse and handler.
|
|
171
|
+
*
|
|
172
|
+
* @param args - The words after `plugininstance`.
|
|
173
|
+
* @returns The answer, or the refusal of a bad line.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* await builtin_plugininstance(['search', 'status:started']);
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
export async function builtin_plugininstance(args) {
|
|
181
|
+
return declaredCommand_run(plugininstanceCommand, args);
|
|
110
182
|
}
|
|
111
183
|
//# sourceMappingURL=plugininstance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugininstance.js","sourceRoot":"","sources":["../../../src/builtins/res/plugininstance.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"plugininstance.js","sourceRoot":"","sources":["../../../src/builtins/res/plugininstance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAA4B,MAAM,gDAAgD,CAAC;AACrH,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,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;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,GAA4B;IACvD,MAAM,IAAI,GAAG,CAAC,GAAW,EAAsB,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,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1,249 @@
|
|
|
1
1
|
import { CommandEnvelope } from '@fnndsc/menu';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* `pluginmeta [[listing options] | list [listing options] | search <term> [listing options] | inspect]`: the declaration.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* commands_register({ declarations: [pluginmetaCommand] }, 'backend');
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare const pluginmetaCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
11
|
+
readonly bare: {
|
|
12
|
+
readonly summary: "List the plugin metas, as list does";
|
|
13
|
+
readonly options: {
|
|
14
|
+
readonly all: {
|
|
15
|
+
readonly long: "all";
|
|
16
|
+
readonly summary: "Fetch every page";
|
|
17
|
+
};
|
|
18
|
+
readonly limit: {
|
|
19
|
+
readonly long: "limit";
|
|
20
|
+
readonly summary: "Page size (default 20)";
|
|
21
|
+
readonly value: {
|
|
22
|
+
readonly name: "n";
|
|
23
|
+
readonly kind: "int";
|
|
24
|
+
readonly min: 1;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly offset: {
|
|
28
|
+
readonly long: "offset";
|
|
29
|
+
readonly summary: "Start this many rows in";
|
|
30
|
+
readonly value: {
|
|
31
|
+
readonly name: "n";
|
|
32
|
+
readonly kind: "int";
|
|
33
|
+
readonly min: 0;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly page: {
|
|
37
|
+
readonly long: "page";
|
|
38
|
+
readonly summary: "Page size, when --limit is not given";
|
|
39
|
+
readonly value: {
|
|
40
|
+
readonly name: "n";
|
|
41
|
+
readonly kind: "int";
|
|
42
|
+
readonly min: 1;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly fields: {
|
|
46
|
+
readonly long: "fields";
|
|
47
|
+
readonly summary: "The columns to show, comma-separated (inspect names them)";
|
|
48
|
+
readonly value: {
|
|
49
|
+
readonly name: "field,…";
|
|
50
|
+
readonly kind: "word";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly search: {
|
|
54
|
+
readonly long: "search";
|
|
55
|
+
readonly summary: "Filter by field:value, comma-separated (inspect names the fields)";
|
|
56
|
+
readonly value: {
|
|
57
|
+
readonly name: "field:value";
|
|
58
|
+
readonly kind: "word";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly sort: {
|
|
62
|
+
readonly long: "sort";
|
|
63
|
+
readonly summary: "Sort by a field";
|
|
64
|
+
readonly value: {
|
|
65
|
+
readonly name: "field";
|
|
66
|
+
readonly kind: "word";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
readonly reverse: {
|
|
70
|
+
readonly long: "reverse";
|
|
71
|
+
readonly summary: "Reverse the sort";
|
|
72
|
+
};
|
|
73
|
+
readonly table: {
|
|
74
|
+
readonly long: "table";
|
|
75
|
+
readonly summary: "Tabular output";
|
|
76
|
+
};
|
|
77
|
+
readonly csv: {
|
|
78
|
+
readonly long: "csv";
|
|
79
|
+
readonly summary: "CSV output";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
readonly subcommands: {
|
|
84
|
+
readonly list: {
|
|
85
|
+
readonly summary: "List the plugin metas, 20 to a page";
|
|
86
|
+
readonly options: {
|
|
87
|
+
readonly all: {
|
|
88
|
+
readonly long: "all";
|
|
89
|
+
readonly summary: "Fetch every page";
|
|
90
|
+
};
|
|
91
|
+
readonly limit: {
|
|
92
|
+
readonly long: "limit";
|
|
93
|
+
readonly summary: "Page size (default 20)";
|
|
94
|
+
readonly value: {
|
|
95
|
+
readonly name: "n";
|
|
96
|
+
readonly kind: "int";
|
|
97
|
+
readonly min: 1;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
readonly offset: {
|
|
101
|
+
readonly long: "offset";
|
|
102
|
+
readonly summary: "Start this many rows in";
|
|
103
|
+
readonly value: {
|
|
104
|
+
readonly name: "n";
|
|
105
|
+
readonly kind: "int";
|
|
106
|
+
readonly min: 0;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
readonly page: {
|
|
110
|
+
readonly long: "page";
|
|
111
|
+
readonly summary: "Page size, when --limit is not given";
|
|
112
|
+
readonly value: {
|
|
113
|
+
readonly name: "n";
|
|
114
|
+
readonly kind: "int";
|
|
115
|
+
readonly min: 1;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly fields: {
|
|
119
|
+
readonly long: "fields";
|
|
120
|
+
readonly summary: "The columns to show, comma-separated (inspect names them)";
|
|
121
|
+
readonly value: {
|
|
122
|
+
readonly name: "field,…";
|
|
123
|
+
readonly kind: "word";
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
readonly search: {
|
|
127
|
+
readonly long: "search";
|
|
128
|
+
readonly summary: "Filter by field:value, comma-separated (inspect names the fields)";
|
|
129
|
+
readonly value: {
|
|
130
|
+
readonly name: "field:value";
|
|
131
|
+
readonly kind: "word";
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
readonly sort: {
|
|
135
|
+
readonly long: "sort";
|
|
136
|
+
readonly summary: "Sort by a field";
|
|
137
|
+
readonly value: {
|
|
138
|
+
readonly name: "field";
|
|
139
|
+
readonly kind: "word";
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
readonly reverse: {
|
|
143
|
+
readonly long: "reverse";
|
|
144
|
+
readonly summary: "Reverse the sort";
|
|
145
|
+
};
|
|
146
|
+
readonly table: {
|
|
147
|
+
readonly long: "table";
|
|
148
|
+
readonly summary: "Tabular output";
|
|
149
|
+
};
|
|
150
|
+
readonly csv: {
|
|
151
|
+
readonly long: "csv";
|
|
152
|
+
readonly summary: "CSV output";
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
readonly search: {
|
|
157
|
+
readonly summary: "List the plugin metas a filter matches (list --search <term>)";
|
|
158
|
+
readonly operands: readonly [{
|
|
159
|
+
readonly name: "term";
|
|
160
|
+
readonly kind: "word";
|
|
161
|
+
readonly summary: "The filter, field:value (inspect names the fields)";
|
|
162
|
+
}];
|
|
163
|
+
readonly options: {
|
|
164
|
+
readonly all: {
|
|
165
|
+
readonly long: "all";
|
|
166
|
+
readonly summary: "Fetch every page";
|
|
167
|
+
};
|
|
168
|
+
readonly limit: {
|
|
169
|
+
readonly long: "limit";
|
|
170
|
+
readonly summary: "Page size (default 20)";
|
|
171
|
+
readonly value: {
|
|
172
|
+
readonly name: "n";
|
|
173
|
+
readonly kind: "int";
|
|
174
|
+
readonly min: 1;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
readonly offset: {
|
|
178
|
+
readonly long: "offset";
|
|
179
|
+
readonly summary: "Start this many rows in";
|
|
180
|
+
readonly value: {
|
|
181
|
+
readonly name: "n";
|
|
182
|
+
readonly kind: "int";
|
|
183
|
+
readonly min: 0;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
readonly page: {
|
|
187
|
+
readonly long: "page";
|
|
188
|
+
readonly summary: "Page size, when --limit is not given";
|
|
189
|
+
readonly value: {
|
|
190
|
+
readonly name: "n";
|
|
191
|
+
readonly kind: "int";
|
|
192
|
+
readonly min: 1;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
readonly fields: {
|
|
196
|
+
readonly long: "fields";
|
|
197
|
+
readonly summary: "The columns to show, comma-separated (inspect names them)";
|
|
198
|
+
readonly value: {
|
|
199
|
+
readonly name: "field,…";
|
|
200
|
+
readonly kind: "word";
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
readonly search: {
|
|
204
|
+
readonly long: "search";
|
|
205
|
+
readonly summary: "Filter by field:value, comma-separated (inspect names the fields)";
|
|
206
|
+
readonly value: {
|
|
207
|
+
readonly name: "field:value";
|
|
208
|
+
readonly kind: "word";
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
readonly sort: {
|
|
212
|
+
readonly long: "sort";
|
|
213
|
+
readonly summary: "Sort by a field";
|
|
214
|
+
readonly value: {
|
|
215
|
+
readonly name: "field";
|
|
216
|
+
readonly kind: "word";
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
readonly reverse: {
|
|
220
|
+
readonly long: "reverse";
|
|
221
|
+
readonly summary: "Reverse the sort";
|
|
222
|
+
};
|
|
223
|
+
readonly table: {
|
|
224
|
+
readonly long: "table";
|
|
225
|
+
readonly summary: "Tabular output";
|
|
226
|
+
};
|
|
227
|
+
readonly csv: {
|
|
228
|
+
readonly long: "csv";
|
|
229
|
+
readonly summary: "CSV output";
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
readonly inspect: {
|
|
234
|
+
readonly summary: "Name the fields a plugin meta has";
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
}>;
|
|
238
|
+
/**
|
|
239
|
+
* `pluginmeta` over words already split: the declaration's parse and handler.
|
|
240
|
+
*
|
|
241
|
+
* @param args - The words after `pluginmeta`.
|
|
242
|
+
* @returns The answer, or the refusal of a bad line.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* await builtin_pluginmeta(['search', 'name:dircopy']);
|
|
247
|
+
* ```
|
|
6
248
|
*/
|
|
7
249
|
export declare function builtin_pluginmeta(args: string[]): Promise<CommandEnvelope>;
|
|
@@ -1,58 +1,116 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file
|
|
2
|
+
* @file `pluginmeta`, `pluginmetas`, `meta` and `metas`: CUBE's plugin
|
|
3
|
+
* metas, each a plugin's identity across its versions, listed, searched, and
|
|
4
|
+
* their fields named.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
+
* Declared in one record (`pluginmetaCommand`, its other names as aliases): the
|
|
7
|
+
* subcommands and the listing options every resource command reads.
|
|
8
|
+
*
|
|
9
|
+
* Key components:
|
|
10
|
+
* - pluginmetaCommand: the declaration, answered under each of its names.
|
|
11
|
+
* - builtin_pluginmeta: the declaration run over words already split.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
6
14
|
*/
|
|
7
15
|
import chalk from 'chalk';
|
|
8
|
-
import { commandArgs_process, cliOptions_extract, resourceListOptions_refusal, resourceSearchTerm_refusal, resourceSearch_args } from '../utils.js';
|
|
9
16
|
import { pluginMetas_fetchList } from '@fnndsc/chili/commands/pluginmetas/list.js';
|
|
10
17
|
import { pluginMetaFields_fetch } from '@fnndsc/chili/commands/pluginmetas/fields.js';
|
|
11
18
|
import { table_render } from '@fnndsc/chili/screen/screen.js';
|
|
12
19
|
import { envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
13
20
|
import { exitCode_set } from '../../core/handlerRun.js';
|
|
21
|
+
import { command_declare } from '../../core/commandDeclaration.js';
|
|
22
|
+
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
23
|
+
import { RESOURCE_LIST_OPTIONS_GRAMMAR, resourceListBag_build } from './resourceList.js';
|
|
14
24
|
/**
|
|
15
|
-
*
|
|
25
|
+
* Lists the plugin metas a listing's options ask for.
|
|
16
26
|
*
|
|
17
|
-
* @param
|
|
27
|
+
* @param options - The bag chili's listing reads.
|
|
28
|
+
* @returns The table, or that there are none, or the error.
|
|
18
29
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (refusal !== null) {
|
|
25
|
-
exitCode_set(1);
|
|
26
|
-
return envelope_error('', undefined, `${chalk.red(refusal)}\n`);
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
const { pluginMetas, selectedFields, totalCount } = await pluginMetas_fetchList(cliOptions_extract(parsed));
|
|
30
|
-
if (pluginMetas.length === 0) {
|
|
31
|
-
return envelope_ok(`${chalk.gray('No plugin metas found.')}\n`);
|
|
32
|
-
}
|
|
33
|
-
return envelope_ok(table_render(pluginMetas, selectedFields, { title: { title: 'Plugin Metas', justification: 'center' }, pagination: totalCount !== undefined ? { shown: pluginMetas.length, total: totalCount } : undefined }));
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
exitCode_set(1);
|
|
37
|
-
return envelope_error('', undefined, `${chalk.red(`pluginmeta error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
30
|
+
async function pluginmetaList_render(options) {
|
|
31
|
+
try {
|
|
32
|
+
const { pluginMetas, selectedFields, totalCount } = await pluginMetas_fetchList(options);
|
|
33
|
+
if (pluginMetas.length === 0) {
|
|
34
|
+
return envelope_ok(`${chalk.gray('No plugin metas found.')}\n`);
|
|
38
35
|
}
|
|
36
|
+
return envelope_ok(table_render(pluginMetas, selectedFields, { title: { title: 'Plugin Metas', justification: 'center' }, pagination: totalCount !== undefined ? { shown: pluginMetas.length, total: totalCount } : undefined }));
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
exitCode_set(1);
|
|
44
|
-
return envelope_error('', undefined, `${chalk.red(refusal)}\n`);
|
|
45
|
-
}
|
|
46
|
-
return builtin_pluginmeta(resourceSearch_args(parsed));
|
|
38
|
+
catch (e) {
|
|
39
|
+
exitCode_set(1);
|
|
40
|
+
return envelope_error('', undefined, `${chalk.red(`pluginmeta error: ${e instanceof Error ? e.message : String(e)}`)}\n`);
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Names the fields a plugin meta has.
|
|
45
|
+
*
|
|
46
|
+
* @returns The fields' table, or that there are none.
|
|
47
|
+
*/
|
|
48
|
+
async function pluginmetaFields_render() {
|
|
49
|
+
const fields = await pluginMetaFields_fetch();
|
|
50
|
+
if (fields && fields.length > 0) {
|
|
51
|
+
return envelope_ok(table_render(fields.map((f) => ({ field: f })), ['field'], { title: { title: 'Plugin Meta fields', justification: 'center' } }));
|
|
54
52
|
}
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
return envelope_ok(`${chalk.gray('No fields found for plugin metas.')}\n`);
|
|
54
|
+
}
|
|
55
|
+
/** What a `pluginmeta` line may hold. */
|
|
56
|
+
const PLUGINMETA_GRAMMAR = {
|
|
57
|
+
bare: { summary: 'List the plugin metas, as list does', options: RESOURCE_LIST_OPTIONS_GRAMMAR },
|
|
58
|
+
subcommands: {
|
|
59
|
+
list: { summary: 'List the plugin metas, 20 to a page', options: RESOURCE_LIST_OPTIONS_GRAMMAR },
|
|
60
|
+
search: {
|
|
61
|
+
summary: 'List the plugin metas a filter matches (list --search <term>)',
|
|
62
|
+
operands: [{ name: 'term', kind: 'word', summary: 'The filter, field:value (inspect names the fields)' }],
|
|
63
|
+
options: RESOURCE_LIST_OPTIONS_GRAMMAR,
|
|
64
|
+
},
|
|
65
|
+
inspect: { summary: 'Name the fields a plugin meta has' },
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Runs one `pluginmeta` line.
|
|
70
|
+
*
|
|
71
|
+
* @param args - The line, parsed.
|
|
72
|
+
* @returns The listing, the fields, or the error.
|
|
73
|
+
*/
|
|
74
|
+
async function pluginmeta_run(args) {
|
|
75
|
+
switch (args.subcommand) {
|
|
76
|
+
case null:
|
|
77
|
+
case 'list': return pluginmetaList_render(resourceListBag_build(args.options));
|
|
78
|
+
case 'search': return pluginmetaList_render(resourceListBag_build(args.options, args.operands.term));
|
|
79
|
+
case 'inspect': return pluginmetaFields_render();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* `pluginmeta [[listing options] | list [listing options] | search <term> [listing options] | inspect]`: the declaration.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* commands_register({ declarations: [pluginmetaCommand] }, 'backend');
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export const pluginmetaCommand = command_declare({
|
|
91
|
+
name: 'pluginmeta',
|
|
92
|
+
aliases: ['pluginmetas', 'meta', 'metas'],
|
|
93
|
+
grammar: PLUGINMETA_GRAMMAR,
|
|
94
|
+
help: {
|
|
95
|
+
summary: "CUBE's plugin metas, each a plugin across its versions: list them, search them, name their fields",
|
|
96
|
+
description: 'List the plugin metas in CUBE, a page at a time or every page, filtered by a field:value search and in the columns asked for; inspect names the fields a plugin meta has. A plugin meta is a tool across its versions (pl-dircopy); a plugin is one version of it. pluginmeta, pluginmetas, meta and metas are one command.',
|
|
97
|
+
category: 'Resources',
|
|
98
|
+
examples: ['pluginmetas list', 'pluginmetas search name:dircopy', 'metas list --fields name,category', 'meta inspect'],
|
|
99
|
+
},
|
|
100
|
+
handler: pluginmeta_run,
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* `pluginmeta` over words already split: the declaration's parse and handler.
|
|
104
|
+
*
|
|
105
|
+
* @param args - The words after `pluginmeta`.
|
|
106
|
+
* @returns The answer, or the refusal of a bad line.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* await builtin_pluginmeta(['search', 'name:dircopy']);
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export async function builtin_pluginmeta(args) {
|
|
114
|
+
return declaredCommand_run(pluginmetaCommand, args);
|
|
57
115
|
}
|
|
58
116
|
//# sourceMappingURL=pluginmeta.js.map
|