@fnndsc/brasa 0.1.0
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/builtins/debug.d.ts +8 -0
- package/dist/builtins/debug.js +39 -0
- package/dist/builtins/debug.js.map +1 -0
- package/dist/builtins/executable.d.ts +22 -0
- package/dist/builtins/executable.js +115 -0
- package/dist/builtins/executable.js.map +1 -0
- package/dist/builtins/fs/cat.d.ts +16 -0
- package/dist/builtins/fs/cat.js +266 -0
- package/dist/builtins/fs/cat.js.map +1 -0
- package/dist/builtins/fs/cd.d.ts +42 -0
- package/dist/builtins/fs/cd.js +193 -0
- package/dist/builtins/fs/cd.js.map +1 -0
- package/dist/builtins/fs/cp.d.ts +10 -0
- package/dist/builtins/fs/cp.js +86 -0
- package/dist/builtins/fs/cp.js.map +1 -0
- package/dist/builtins/fs/download.d.ts +6 -0
- package/dist/builtins/fs/download.js +45 -0
- package/dist/builtins/fs/download.js.map +1 -0
- package/dist/builtins/fs/du.d.ts +58 -0
- package/dist/builtins/fs/du.js +210 -0
- package/dist/builtins/fs/du.js.map +1 -0
- package/dist/builtins/fs/edit.d.ts +7 -0
- package/dist/builtins/fs/edit.js +104 -0
- package/dist/builtins/fs/edit.js.map +1 -0
- package/dist/builtins/fs/ls.d.ts +8 -0
- package/dist/builtins/fs/ls.js +68 -0
- package/dist/builtins/fs/ls.js.map +1 -0
- package/dist/builtins/fs/mkdir.d.ts +9 -0
- package/dist/builtins/fs/mkdir.js +52 -0
- package/dist/builtins/fs/mkdir.js.map +1 -0
- package/dist/builtins/fs/mv.d.ts +10 -0
- package/dist/builtins/fs/mv.js +88 -0
- package/dist/builtins/fs/mv.js.map +1 -0
- package/dist/builtins/fs/pull.args.d.ts +22 -0
- package/dist/builtins/fs/pull.args.js +30 -0
- package/dist/builtins/fs/pull.args.js.map +1 -0
- package/dist/builtins/fs/pull.d.ts +26 -0
- package/dist/builtins/fs/pull.js +445 -0
- package/dist/builtins/fs/pull.js.map +1 -0
- package/dist/builtins/fs/pwd.d.ts +10 -0
- package/dist/builtins/fs/pwd.js +73 -0
- package/dist/builtins/fs/pwd.js.map +1 -0
- package/dist/builtins/fs/rm.d.ts +37 -0
- package/dist/builtins/fs/rm.js +197 -0
- package/dist/builtins/fs/rm.js.map +1 -0
- package/dist/builtins/fs/touch.d.ts +9 -0
- package/dist/builtins/fs/touch.js +76 -0
- package/dist/builtins/fs/touch.js.map +1 -0
- package/dist/builtins/fs/tree.d.ts +15 -0
- package/dist/builtins/fs/tree.js +84 -0
- package/dist/builtins/fs/tree.js.map +1 -0
- package/dist/builtins/fs/upload.d.ts +6 -0
- package/dist/builtins/fs/upload.js +48 -0
- package/dist/builtins/fs/upload.js.map +1 -0
- package/dist/builtins/help.d.ts +74 -0
- package/dist/builtins/help.js +1217 -0
- package/dist/builtins/help.js.map +1 -0
- package/dist/builtins/index.d.ts +45 -0
- package/dist/builtins/index.js +45 -0
- package/dist/builtins/index.js.map +1 -0
- package/dist/builtins/net/connect.d.ts +7 -0
- package/dist/builtins/net/connect.js +42 -0
- package/dist/builtins/net/connect.js.map +1 -0
- package/dist/builtins/net/cubepath.d.ts +18 -0
- package/dist/builtins/net/cubepath.js +102 -0
- package/dist/builtins/net/cubepath.js.map +1 -0
- package/dist/builtins/net/logout.d.ts +6 -0
- package/dist/builtins/net/logout.js +24 -0
- package/dist/builtins/net/logout.js.map +1 -0
- package/dist/builtins/net/pacs.d.ts +24 -0
- package/dist/builtins/net/pacs.js +121 -0
- package/dist/builtins/net/pacs.js.map +1 -0
- package/dist/builtins/net/pacsUtils.d.ts +85 -0
- package/dist/builtins/net/pacsUtils.js +184 -0
- package/dist/builtins/net/pacsUtils.js.map +1 -0
- package/dist/builtins/net/query.d.ts +60 -0
- package/dist/builtins/net/query.js +324 -0
- package/dist/builtins/net/query.js.map +1 -0
- package/dist/builtins/parametersofplugin.d.ts +13 -0
- package/dist/builtins/parametersofplugin.js +43 -0
- package/dist/builtins/parametersofplugin.js.map +1 -0
- package/dist/builtins/pluginExecute.d.ts +27 -0
- package/dist/builtins/pluginExecute.js +165 -0
- package/dist/builtins/pluginExecute.js.map +1 -0
- package/dist/builtins/proc.d.ts +6 -0
- package/dist/builtins/proc.helpers.d.ts +68 -0
- package/dist/builtins/proc.helpers.js +102 -0
- package/dist/builtins/proc.helpers.js.map +1 -0
- package/dist/builtins/proc.js +289 -0
- package/dist/builtins/proc.js.map +1 -0
- package/dist/builtins/res/compute.d.ts +6 -0
- package/dist/builtins/res/compute.js +55 -0
- package/dist/builtins/res/compute.js.map +1 -0
- package/dist/builtins/res/feed.d.ts +6 -0
- package/dist/builtins/res/feed.js +244 -0
- package/dist/builtins/res/feed.js.map +1 -0
- package/dist/builtins/res/feed.notes.d.ts +28 -0
- package/dist/builtins/res/feed.notes.js +24 -0
- package/dist/builtins/res/feed.notes.js.map +1 -0
- package/dist/builtins/res/files.d.ts +18 -0
- package/dist/builtins/res/files.js +85 -0
- package/dist/builtins/res/files.js.map +1 -0
- package/dist/builtins/res/group.d.ts +6 -0
- package/dist/builtins/res/group.js +54 -0
- package/dist/builtins/res/group.js.map +1 -0
- package/dist/builtins/res/pipeline.args.d.ts +22 -0
- package/dist/builtins/res/pipeline.args.js +28 -0
- package/dist/builtins/res/pipeline.args.js.map +1 -0
- package/dist/builtins/res/pipeline.d.ts +20 -0
- package/dist/builtins/res/pipeline.js +252 -0
- package/dist/builtins/res/pipeline.js.map +1 -0
- package/dist/builtins/res/plugin.d.ts +13 -0
- package/dist/builtins/res/plugin.js +140 -0
- package/dist/builtins/res/plugin.js.map +1 -0
- package/dist/builtins/res/plugininstance.d.ts +6 -0
- package/dist/builtins/res/plugininstance.js +53 -0
- package/dist/builtins/res/plugininstance.js.map +1 -0
- package/dist/builtins/res/pluginmeta.d.ts +6 -0
- package/dist/builtins/res/pluginmeta.js +53 -0
- package/dist/builtins/res/pluginmeta.js.map +1 -0
- package/dist/builtins/res/tag.d.ts +6 -0
- package/dist/builtins/res/tag.js +53 -0
- package/dist/builtins/res/tag.js.map +1 -0
- package/dist/builtins/res/workflow.d.ts +6 -0
- package/dist/builtins/res/workflow.js +53 -0
- package/dist/builtins/res/workflow.js.map +1 -0
- package/dist/builtins/store.d.ts +6 -0
- package/dist/builtins/store.js +107 -0
- package/dist/builtins/store.js.map +1 -0
- package/dist/builtins/sys/context.d.ts +6 -0
- package/dist/builtins/sys/context.js +50 -0
- package/dist/builtins/sys/context.js.map +1 -0
- package/dist/builtins/sys/physicalmode.d.ts +8 -0
- package/dist/builtins/sys/physicalmode.js +34 -0
- package/dist/builtins/sys/physicalmode.js.map +1 -0
- package/dist/builtins/sys/timing.d.ts +8 -0
- package/dist/builtins/sys/timing.js +34 -0
- package/dist/builtins/sys/timing.js.map +1 -0
- package/dist/builtins/sys/version.d.ts +15 -0
- package/dist/builtins/sys/version.js +23 -0
- package/dist/builtins/sys/version.js.map +1 -0
- package/dist/builtins/sys/whoami.d.ts +17 -0
- package/dist/builtins/sys/whoami.js +44 -0
- package/dist/builtins/sys/whoami.js.map +1 -0
- package/dist/builtins/utils.d.ts +55 -0
- package/dist/builtins/utils.js +145 -0
- package/dist/builtins/utils.js.map +1 -0
- package/dist/builtins/wildcard.d.ts +26 -0
- package/dist/builtins/wildcard.js +120 -0
- package/dist/builtins/wildcard.js.map +1 -0
- package/dist/command-keys.d.ts +8 -0
- package/dist/command-keys.js +32 -0
- package/dist/command-keys.js.map +1 -0
- package/dist/config/storeConfig.d.ts +57 -0
- package/dist/config/storeConfig.js +78 -0
- package/dist/config/storeConfig.js.map +1 -0
- package/dist/core/chiliDelegate.d.ts +21 -0
- package/dist/core/chiliDelegate.js +32 -0
- package/dist/core/chiliDelegate.js.map +1 -0
- package/dist/core/connect.d.ts +38 -0
- package/dist/core/connect.js +46 -0
- package/dist/core/connect.js.map +1 -0
- package/dist/core/dispatch.d.ts +95 -0
- package/dist/core/dispatch.js +618 -0
- package/dist/core/dispatch.js.map +1 -0
- package/dist/core/engine.d.ts +91 -0
- package/dist/core/engine.js +222 -0
- package/dist/core/engine.js.map +1 -0
- package/dist/core/preprocess.d.ts +46 -0
- package/dist/core/preprocess.js +146 -0
- package/dist/core/preprocess.js.map +1 -0
- package/dist/core/progress.d.ts +50 -0
- package/dist/core/progress.js +21 -0
- package/dist/core/progress.js.map +1 -0
- package/dist/core/promptContext.d.ts +49 -0
- package/dist/core/promptContext.js +39 -0
- package/dist/core/promptContext.js.map +1 -0
- package/dist/core/question.d.ts +27 -0
- package/dist/core/question.js +33 -0
- package/dist/core/question.js.map +1 -0
- package/dist/core/sink.d.ts +207 -0
- package/dist/core/sink.js +329 -0
- package/dist/core/sink.js.map +1 -0
- package/dist/core/surface.d.ts +172 -0
- package/dist/core/surface.js +105 -0
- package/dist/core/surface.js.map +1 -0
- package/dist/core/version.d.ts +20 -0
- package/dist/core/version.js +82 -0
- package/dist/core/version.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/completer/index.d.ts +15 -0
- package/dist/lib/completer/index.js +212 -0
- package/dist/lib/completer/index.js.map +1 -0
- package/dist/lib/completer/pathComplete.helpers.d.ts +22 -0
- package/dist/lib/completer/pathComplete.helpers.js +49 -0
- package/dist/lib/completer/pathComplete.helpers.js.map +1 -0
- package/dist/lib/parser.d.ts +13 -0
- package/dist/lib/parser.js +52 -0
- package/dist/lib/parser.js.map +1 -0
- package/dist/lib/pipe.d.ts +11 -0
- package/dist/lib/pipe.js +90 -0
- package/dist/lib/pipe.js.map +1 -0
- package/dist/lib/prefetch.d.ts +25 -0
- package/dist/lib/prefetch.js +64 -0
- package/dist/lib/prefetch.js.map +1 -0
- package/dist/lib/semicolonParser.d.ts +22 -0
- package/dist/lib/semicolonParser.js +53 -0
- package/dist/lib/semicolonParser.js.map +1 -0
- package/dist/lib/spinner.d.ts +23 -0
- package/dist/lib/spinner.js +71 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/vfs/providers/static.d.ts +65 -0
- package/dist/lib/vfs/providers/static.js +164 -0
- package/dist/lib/vfs/providers/static.js.map +1 -0
- package/dist/lib/vfs/providers/static_content.d.ts +27 -0
- package/dist/lib/vfs/providers/static_content.js +180 -0
- package/dist/lib/vfs/providers/static_content.js.map +1 -0
- package/dist/lib/vfs/vfs.d.ts +59 -0
- package/dist/lib/vfs/vfs.js +202 -0
- package/dist/lib/vfs/vfs.js.map +1 -0
- package/dist/session/index.d.ts +76 -0
- package/dist/session/index.js +120 -0
- package/dist/session/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,1217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Command help system.
|
|
3
|
+
*
|
|
4
|
+
* Provides help text for shell commands.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
/**
|
|
10
|
+
* Standard subcommands and options injected into every resource help entry.
|
|
11
|
+
* Captures the Resource Contract documented in CONTEXT.md.
|
|
12
|
+
*/
|
|
13
|
+
export const RESOURCE_LIST_OPTIONS = [
|
|
14
|
+
'',
|
|
15
|
+
'STANDARD SUBCOMMANDS:',
|
|
16
|
+
' list List resources (default: 20 per page)',
|
|
17
|
+
' search <term> Search resources (alias: list --search <term>)',
|
|
18
|
+
' inspect List available field names',
|
|
19
|
+
'',
|
|
20
|
+
'STANDARD OPTIONS:',
|
|
21
|
+
' --all Fetch all pages',
|
|
22
|
+
' --limit <n> Page size (default: 20)',
|
|
23
|
+
' --fields <f,f> Columns to display',
|
|
24
|
+
' --sort <field> Sort by field',
|
|
25
|
+
' --reverse Reverse sort order',
|
|
26
|
+
' --table Tabular output',
|
|
27
|
+
' --csv CSV output',
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Help-text registry keyed by builtin command name.
|
|
31
|
+
*/
|
|
32
|
+
export const helpText = {
|
|
33
|
+
ls: {
|
|
34
|
+
usage: 'ls [options] [path]',
|
|
35
|
+
description: 'List directory contents',
|
|
36
|
+
options: [
|
|
37
|
+
'-l Long format (detailed information, shows feed/plugin titles)',
|
|
38
|
+
'-1 One entry per line (single-column)',
|
|
39
|
+
'-h Human-readable sizes (use with -l)',
|
|
40
|
+
'-f, --refresh Force refresh (ignore cache)',
|
|
41
|
+
'-r, --reverse Reverse sort order',
|
|
42
|
+
'-d List directory itself, not contents',
|
|
43
|
+
'--sort=<field> Sort by: name, size, date, owner',
|
|
44
|
+
],
|
|
45
|
+
examples: [
|
|
46
|
+
'ls # List current directory',
|
|
47
|
+
'ls -l # Long format with titles',
|
|
48
|
+
'ls -lh # Long format with human sizes',
|
|
49
|
+
'ls -f # Force refresh from server',
|
|
50
|
+
'ls /home/user/data # List specific directory',
|
|
51
|
+
'ls *.txt # List matching files (wildcard)',
|
|
52
|
+
'ls --sort=size -r # Sort by size, reversed',
|
|
53
|
+
'',
|
|
54
|
+
'# Long format shows feed and plugin instance titles:',
|
|
55
|
+
'# d user 0 2025-05-18 feed_875 Brain MRI Analysis',
|
|
56
|
+
'# d user 0 2025-05-18 pl-dircopy_33314 pl-dircopy v2.1.2',
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
cd: {
|
|
60
|
+
usage: 'cd [path]',
|
|
61
|
+
description: 'Change current working directory',
|
|
62
|
+
examples: [
|
|
63
|
+
'cd /home/user/data # Absolute path',
|
|
64
|
+
'cd experiments # Relative path',
|
|
65
|
+
'cd .. # Parent directory',
|
|
66
|
+
'cd ~ # Home directory',
|
|
67
|
+
'cd # Show current directory',
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
pwd: {
|
|
71
|
+
usage: 'pwd [options]',
|
|
72
|
+
description: 'Print current working directory',
|
|
73
|
+
options: [
|
|
74
|
+
'--title Replace feed_XXXX and pl-<name>_XXXX with titles in path',
|
|
75
|
+
],
|
|
76
|
+
examples: [
|
|
77
|
+
'pwd # Show actual path',
|
|
78
|
+
'pwd --title # Show path with feed/plugin titles',
|
|
79
|
+
'',
|
|
80
|
+
'# Example output:',
|
|
81
|
+
'# pwd',
|
|
82
|
+
'# /home/chris/feeds/feed_2326/pl-dircopy_176660/data',
|
|
83
|
+
'',
|
|
84
|
+
'# pwd --title',
|
|
85
|
+
'# /home/chris/feeds/Brain MRI Analysis/dircopy v2.1.1/data',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
cat: {
|
|
89
|
+
usage: 'cat <file> [file...]',
|
|
90
|
+
description: 'Display file contents',
|
|
91
|
+
examples: [
|
|
92
|
+
'cat file.txt # Display single file',
|
|
93
|
+
'cat file1 file2 # Display multiple files',
|
|
94
|
+
'cat *.log # Display all .log files (wildcard)',
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
edit: {
|
|
98
|
+
usage: 'edit <file>',
|
|
99
|
+
description: 'Edit a ChRIS file in $EDITOR — fetches, opens, saves back on write',
|
|
100
|
+
options: [
|
|
101
|
+
'Uses $EDITOR (or $VISUAL, or vi as fallback)',
|
|
102
|
+
'No-ops if file is unchanged on exit',
|
|
103
|
+
'On save: deletes original and re-uploads — file path preserved, ID changes',
|
|
104
|
+
'On upload failure: edited content preserved in /tmp',
|
|
105
|
+
],
|
|
106
|
+
examples: [
|
|
107
|
+
'edit /home/chris/uploads/config.yaml',
|
|
108
|
+
'edit notes.txt',
|
|
109
|
+
'EDITOR=nano edit report.json',
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
rm: {
|
|
113
|
+
usage: 'rm [options] <path> [path...]',
|
|
114
|
+
description: 'Remove files or directories',
|
|
115
|
+
options: [
|
|
116
|
+
'-r, -R Remove directories recursively',
|
|
117
|
+
'-f Force removal',
|
|
118
|
+
'-i Prompt before every removal (interactive)',
|
|
119
|
+
'-rf, -fr Recursive and force combined',
|
|
120
|
+
'-ri, -ir Recursive and interactive combined',
|
|
121
|
+
'-- End of options (treat remaining args as filenames)',
|
|
122
|
+
],
|
|
123
|
+
examples: [
|
|
124
|
+
'rm file.txt # Remove single file',
|
|
125
|
+
'rm file1 file2 # Remove multiple files',
|
|
126
|
+
'rm *.json # Remove all .json files (wildcard)',
|
|
127
|
+
'rm -i *.log # Prompt before removing each .log file',
|
|
128
|
+
'rm -r directory/ # Remove directory recursively',
|
|
129
|
+
'rm -rf temp_* # Force remove all temp_* dirs',
|
|
130
|
+
'rm -- --weird-name # Remove file starting with --',
|
|
131
|
+
'rm -- -dash-file # Remove file starting with -',
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
cp: {
|
|
135
|
+
usage: 'cp [options] <source...> <dest>',
|
|
136
|
+
description: 'Copy files or directories (supports wildcards and multiple sources)',
|
|
137
|
+
options: [
|
|
138
|
+
'-r, --recursive Recursive copy (for directories)',
|
|
139
|
+
],
|
|
140
|
+
examples: [
|
|
141
|
+
'cp file.txt copy.txt # Copy single file',
|
|
142
|
+
'cp -r dir1/ dir2/ # Copy directory recursively',
|
|
143
|
+
'cp file1 file2 file3 dest/ # Copy multiple files',
|
|
144
|
+
'cp uploads/*.txt backup/ # Copy with wildcard',
|
|
145
|
+
'cp "file with spaces.txt" dest/ # Use quotes for spaces',
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
mv: {
|
|
149
|
+
usage: 'mv <source...> <dest>',
|
|
150
|
+
description: 'Move or rename files or directories (supports wildcards and multiple sources)',
|
|
151
|
+
examples: [
|
|
152
|
+
'mv old.txt new.txt # Rename file',
|
|
153
|
+
'mv dir1/ dir2/ # Move directory into dir2',
|
|
154
|
+
'mv file.txt /home/user/archive/ # Move into existing directory',
|
|
155
|
+
'mv file1 file2 file3 dest/ # Move multiple files',
|
|
156
|
+
'mv uploads/* backup/ # Move with wildcard',
|
|
157
|
+
'mv "file with spaces.txt" dest/ # Use quotes for spaces',
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
touch: {
|
|
161
|
+
usage: 'touch [options] <file>',
|
|
162
|
+
description: 'Create empty files or files with content',
|
|
163
|
+
options: [
|
|
164
|
+
'--withContents <string> Create file with inline string content',
|
|
165
|
+
'--withContentsFromFile <file> Create file with content from local host file',
|
|
166
|
+
],
|
|
167
|
+
examples: [
|
|
168
|
+
'touch file.txt # Create empty file',
|
|
169
|
+
'touch --withContents "Hello!" greeting.txt # Create file with string',
|
|
170
|
+
'touch --withContentsFromFile template.json config.json # Create from local file',
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
mkdir: {
|
|
174
|
+
usage: 'mkdir <directory> [directory...]',
|
|
175
|
+
description: 'Create directories',
|
|
176
|
+
examples: [
|
|
177
|
+
'mkdir newdir # Create single directory',
|
|
178
|
+
'mkdir dir1 dir2 # Create multiple directories',
|
|
179
|
+
'mkdir experiments/run1 # Create nested directory',
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
upload: {
|
|
183
|
+
usage: 'upload <local_path> <chris_path>',
|
|
184
|
+
description: 'Upload files from local filesystem to ChRIS with progress tracking',
|
|
185
|
+
options: [
|
|
186
|
+
'Displays progress bar showing:',
|
|
187
|
+
' - File count and percentage complete',
|
|
188
|
+
' - Estimated time remaining (ETA)',
|
|
189
|
+
' - Data transfer progress',
|
|
190
|
+
'Shows summary statistics after upload',
|
|
191
|
+
],
|
|
192
|
+
examples: [
|
|
193
|
+
'upload ~/data/file.csv /home/user/uploads/',
|
|
194
|
+
'upload ./results/ ~/data/',
|
|
195
|
+
'upload ~/experiment/data /home/user/projects/',
|
|
196
|
+
],
|
|
197
|
+
},
|
|
198
|
+
download: {
|
|
199
|
+
usage: 'download <chris_path> <local_path> [-f|--force]',
|
|
200
|
+
description: 'Download a ChRIS file or directory to the local filesystem with progress tracking',
|
|
201
|
+
options: [
|
|
202
|
+
'-f, --force Overwrite existing local paths',
|
|
203
|
+
'Progress bar shows files, ETA, bytes transferred',
|
|
204
|
+
],
|
|
205
|
+
examples: [
|
|
206
|
+
'download /home/user/data ./data',
|
|
207
|
+
'download /feeds/feed_123 ./downloads -f',
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
connect: {
|
|
211
|
+
usage: 'connect <username> <url> [password]',
|
|
212
|
+
description: 'Connect to ChRIS server',
|
|
213
|
+
examples: [
|
|
214
|
+
'connect alice https://cube.chrisproject.org/api/v1/',
|
|
215
|
+
'connect bob http://localhost:8000/api/v1/ mypassword',
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
logout: {
|
|
219
|
+
usage: 'logout',
|
|
220
|
+
description: 'Disconnect from ChRIS server',
|
|
221
|
+
examples: ['logout'],
|
|
222
|
+
},
|
|
223
|
+
plugin: {
|
|
224
|
+
usage: 'plugin <subcommand> [options]',
|
|
225
|
+
description: 'Work with a single ChRIS plugin - run, search, view documentation',
|
|
226
|
+
options: [
|
|
227
|
+
'',
|
|
228
|
+
'DESCRIPTION:',
|
|
229
|
+
' Plugins are computational units in ChRIS that process data. The "plugin"',
|
|
230
|
+
' command operates on individual plugins - running them, searching for specific',
|
|
231
|
+
' plugins, or viewing their documentation.',
|
|
232
|
+
'',
|
|
233
|
+
'SUBCOMMANDS:',
|
|
234
|
+
' run <searchable> [params] Execute a plugin instance with parameters',
|
|
235
|
+
' search <searchable> Resolve a searchable to plugin IDs',
|
|
236
|
+
' readme <pluginId> Display plugin README documentation',
|
|
237
|
+
'',
|
|
238
|
+
'SEARCHABLE FORMATS:',
|
|
239
|
+
' Simple: pl-dircopy',
|
|
240
|
+
' Compound: name:pl-dircopy,version:1.3.2',
|
|
241
|
+
' ID-based: id:42',
|
|
242
|
+
' Batch: id:77++id:33 (multiple plugins)',
|
|
243
|
+
'',
|
|
244
|
+
'PLUGIN RUN PARAMETERS:',
|
|
245
|
+
' Plugin-specific parameters use CLI flag format:',
|
|
246
|
+
' --param value Single parameter',
|
|
247
|
+
' --flag Boolean flag',
|
|
248
|
+
' --param1 val1 --param2 val2 Multiple parameters',
|
|
249
|
+
'',
|
|
250
|
+
' Run "parametersofplugin <name>" to see available parameters for a plugin.',
|
|
251
|
+
],
|
|
252
|
+
examples: [
|
|
253
|
+
'# Search for plugins',
|
|
254
|
+
'plugin search pl-dircopy',
|
|
255
|
+
'plugin search name:dcm2niix',
|
|
256
|
+
'plugin search id:42',
|
|
257
|
+
'',
|
|
258
|
+
'# View plugin documentation',
|
|
259
|
+
'plugin readme 42',
|
|
260
|
+
'plugin readme pl-dircopy',
|
|
261
|
+
'',
|
|
262
|
+
'# Run a plugin (simple)',
|
|
263
|
+
'plugin run pl-dircopy',
|
|
264
|
+
'',
|
|
265
|
+
'# Run plugin with parameters',
|
|
266
|
+
'plugin run pl-dircopy --dir /incoming',
|
|
267
|
+
'plugin run name:pl-dcm2niix,version:1.0.2 --outputdir /results',
|
|
268
|
+
'',
|
|
269
|
+
'# Run with multiple parameters',
|
|
270
|
+
'plugin run pl-segmentation --threshold 0.5 --method watershed',
|
|
271
|
+
'',
|
|
272
|
+
'# Run with specific version',
|
|
273
|
+
'plugin run name:pl-dircopy,version:2.1.1 --dir /data',
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
plugins: {
|
|
277
|
+
usage: 'plugins <subcommand> [options]',
|
|
278
|
+
description: 'Manage collections of ChRIS plugins - list, add, delete, query',
|
|
279
|
+
options: [
|
|
280
|
+
'',
|
|
281
|
+
'DESCRIPTION:',
|
|
282
|
+
' Plugins are computational units in ChRIS. The "plugins" command operates on',
|
|
283
|
+
' collections of plugins - listing all available plugins, adding new plugins to',
|
|
284
|
+
' ChRIS, deleting plugins, or querying plugin metadata.',
|
|
285
|
+
...RESOURCE_LIST_OPTIONS,
|
|
286
|
+
'',
|
|
287
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
288
|
+
' add <input> [admin] Register a new plugin to ChRIS',
|
|
289
|
+
' delete <id> [admin] Remove a plugin from ChRIS',
|
|
290
|
+
' overview Show plugin system overview',
|
|
291
|
+
'',
|
|
292
|
+
'PLUGINS ADD OPTIONS:',
|
|
293
|
+
' --compute <resources> Comma-separated compute resources (default: host)',
|
|
294
|
+
' --store <url> Peer store URL (default: cube.chrisproject.org)',
|
|
295
|
+
' --adminUser <username> Admin username (to skip interactive prompt)',
|
|
296
|
+
' --adminPassword <password> Admin password (to skip interactive prompt)',
|
|
297
|
+
' --publicRepo <url> Public repository URL for the plugin',
|
|
298
|
+
'',
|
|
299
|
+
'PLUGIN INPUT FORMATS:',
|
|
300
|
+
' Plugin name: pl-dircopy',
|
|
301
|
+
' Docker image: fnndsc/pl-dircopy:2.1.1',
|
|
302
|
+
' Store URL: https://cube.chrisproject.org/api/v1/plugins/96/',
|
|
303
|
+
],
|
|
304
|
+
examples: [
|
|
305
|
+
'# List all plugins',
|
|
306
|
+
'plugins list',
|
|
307
|
+
'plugins list --all',
|
|
308
|
+
'plugins list --search name:dircopy',
|
|
309
|
+
'plugins list --fields name,version,dock_image',
|
|
310
|
+
'plugins search dircopy',
|
|
311
|
+
'',
|
|
312
|
+
'# Inspect available fields',
|
|
313
|
+
'plugins inspect',
|
|
314
|
+
'',
|
|
315
|
+
'# Delete a plugin',
|
|
316
|
+
'plugins delete 42',
|
|
317
|
+
'',
|
|
318
|
+
'# Show plugin system overview',
|
|
319
|
+
'plugins overview',
|
|
320
|
+
'',
|
|
321
|
+
'# Add plugin from peer store (searches cube.chrisproject.org)',
|
|
322
|
+
'plugins add pl-dircopy',
|
|
323
|
+
'plugins add pl-dircopy --compute host,gpu',
|
|
324
|
+
'',
|
|
325
|
+
'# Add plugin with admin credentials (skip prompt)',
|
|
326
|
+
'plugins add pl-dircopy --adminUser chris --adminPassword chris1234',
|
|
327
|
+
'',
|
|
328
|
+
'# Add plugin from Docker image',
|
|
329
|
+
'plugins add fnndsc/pl-dircopy:2.1.1',
|
|
330
|
+
'plugins add fnndsc/pl-dircopy:2.1.1 --compute host',
|
|
331
|
+
'',
|
|
332
|
+
'# Add plugin from custom peer store',
|
|
333
|
+
'plugins add pl-custom --store https://my-cube.org/api/v1/',
|
|
334
|
+
'',
|
|
335
|
+
'# Add plugin with specific repository',
|
|
336
|
+
'plugins add my-plugin:latest --publicRepo https://github.com/org/my-plugin',
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
feed: {
|
|
340
|
+
usage: 'feed <subcommand> [options]',
|
|
341
|
+
description: 'Work with a single ChRIS feed - create, annotate, comment',
|
|
342
|
+
options: [
|
|
343
|
+
'',
|
|
344
|
+
'SUBCOMMANDS:',
|
|
345
|
+
' create <path> Create a new feed from a data directory',
|
|
346
|
+
' note <feedId> Show the feed\'s note',
|
|
347
|
+
' note edit <feedId> Open note in $EDITOR',
|
|
348
|
+
' note <feedId> --title <t> Update note title',
|
|
349
|
+
' note <feedId> --content <c> Update note content',
|
|
350
|
+
' comments <feedId> List all comments on a feed',
|
|
351
|
+
' comment add <feedId> Add a comment (--title, --content)',
|
|
352
|
+
' comment edit <feedId> <commentId> Edit a comment (--title, --content)',
|
|
353
|
+
' comment delete <feedId> <commentId> Delete a comment',
|
|
354
|
+
],
|
|
355
|
+
examples: [
|
|
356
|
+
'feed create /home/user/uploads/MRI-data',
|
|
357
|
+
'feed note 42',
|
|
358
|
+
'feed note 42 --title "QC passed" --content "No artefacts found"',
|
|
359
|
+
'feed comments 42',
|
|
360
|
+
'feed comment add 42 --title "Issue" --content "Slice 14 looks odd"',
|
|
361
|
+
'feed comment edit 42 7 --content "Resolved — motion artefact, excluded"',
|
|
362
|
+
'feed comment delete 42 7',
|
|
363
|
+
],
|
|
364
|
+
},
|
|
365
|
+
feeds: {
|
|
366
|
+
usage: 'feeds <subcommand> [options]',
|
|
367
|
+
description: 'Manage collections of ChRIS feeds - list, delete, share, query',
|
|
368
|
+
options: [
|
|
369
|
+
'',
|
|
370
|
+
'DESCRIPTION:',
|
|
371
|
+
' A feed represents a data analysis workflow in ChRIS - a DAG of linked plugin',
|
|
372
|
+
' instances, also navigable as a folder at /home/<user>/feeds/.',
|
|
373
|
+
...RESOURCE_LIST_OPTIONS,
|
|
374
|
+
'--user <username> Filter by owner username (admin only)',
|
|
375
|
+
'',
|
|
376
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
377
|
+
' delete <id> Remove a feed',
|
|
378
|
+
' share <id> Share a feed with other users',
|
|
379
|
+
],
|
|
380
|
+
examples: [
|
|
381
|
+
'feeds list',
|
|
382
|
+
'feeds list --all',
|
|
383
|
+
'feeds list --limit 100',
|
|
384
|
+
'feeds search experiment',
|
|
385
|
+
'feeds list --fields id,name,creation_date',
|
|
386
|
+
'feeds list --user radstar',
|
|
387
|
+
'feeds list --all --user radstar',
|
|
388
|
+
'feeds inspect',
|
|
389
|
+
'feeds delete 123',
|
|
390
|
+
'feeds share 123',
|
|
391
|
+
],
|
|
392
|
+
},
|
|
393
|
+
files: {
|
|
394
|
+
usage: 'files <subcommand> [path] [options]',
|
|
395
|
+
description: 'Manage ChRIS file resources',
|
|
396
|
+
options: [...RESOURCE_LIST_OPTIONS],
|
|
397
|
+
examples: [
|
|
398
|
+
'files list',
|
|
399
|
+
'files list /path',
|
|
400
|
+
'files search fname:dicom',
|
|
401
|
+
'files inspect',
|
|
402
|
+
],
|
|
403
|
+
},
|
|
404
|
+
links: {
|
|
405
|
+
usage: 'links <subcommand> [path] [options]',
|
|
406
|
+
description: 'Manage ChRIS link resources',
|
|
407
|
+
options: [...RESOURCE_LIST_OPTIONS],
|
|
408
|
+
examples: ['links list', 'links search', 'links inspect'],
|
|
409
|
+
},
|
|
410
|
+
dirs: {
|
|
411
|
+
usage: 'dirs <subcommand> [path] [options]',
|
|
412
|
+
description: 'Manage ChRIS directory resources',
|
|
413
|
+
options: [...RESOURCE_LIST_OPTIONS],
|
|
414
|
+
examples: ['dirs list', 'dirs search', 'dirs inspect'],
|
|
415
|
+
},
|
|
416
|
+
pipeline: {
|
|
417
|
+
usage: 'pipeline <subcommand> [args]',
|
|
418
|
+
description: 'Manage and execute ChRIS pipelines (registered DAG workflows)',
|
|
419
|
+
options: [
|
|
420
|
+
...RESOURCE_LIST_OPTIONS,
|
|
421
|
+
'',
|
|
422
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
423
|
+
' info <name|id> Show pipeline nodes, plugins, and topology',
|
|
424
|
+
' run <name|id> Execute pipeline on current context node',
|
|
425
|
+
' source <name|id> Display the pipeline YAML source file',
|
|
426
|
+
' delete <id> Remove a pipeline',
|
|
427
|
+
'',
|
|
428
|
+
'RUN OPTIONS:',
|
|
429
|
+
' --compute <resource> Override compute resource for all nodes',
|
|
430
|
+
' --previous <inst_id> Explicit previous instance ID (default: context node)',
|
|
431
|
+
'',
|
|
432
|
+
'PIPELINE EXECUTABLES:',
|
|
433
|
+
' Pipelines also appear in /bin (colored magenta) and can be invoked directly.',
|
|
434
|
+
' <PipelineName> Run pipeline on context node',
|
|
435
|
+
' <PipelineName> --nodes Show DAG structure (alias: --parameters)',
|
|
436
|
+
' <PipelineName> --source Show YAML source (alias: --readme)',
|
|
437
|
+
' cat /bin/<PipelineName> Same as pipeline source',
|
|
438
|
+
],
|
|
439
|
+
examples: [
|
|
440
|
+
'pipeline list # List all pipelines',
|
|
441
|
+
'pipeline list PHI # Filter by name',
|
|
442
|
+
'pipeline info PHI_detection # Show nodes and topology',
|
|
443
|
+
'pipeline run PHI_detection # Run on current context node',
|
|
444
|
+
'pipeline run PHI_detection --compute gpu',
|
|
445
|
+
'pipeline source PHI_detection # Show YAML source',
|
|
446
|
+
'',
|
|
447
|
+
'# Direct invocation from /bin',
|
|
448
|
+
'PHI_detection # Run with defaults',
|
|
449
|
+
'PHI_detection --nodes # Show node structure',
|
|
450
|
+
'PHI_detection --source # Show YAML source',
|
|
451
|
+
'cat /bin/PHI_detection # Same as --source',
|
|
452
|
+
],
|
|
453
|
+
},
|
|
454
|
+
pacs: {
|
|
455
|
+
usage: 'pacs <subcommand> [args]',
|
|
456
|
+
description: 'PACS subsystem — server context, query, and series retrieval',
|
|
457
|
+
options: [
|
|
458
|
+
'SUBCOMMANDS:',
|
|
459
|
+
' connect List registered PACS servers with active one marked',
|
|
460
|
+
' connect <name|id> Set active PACS server',
|
|
461
|
+
' disconnect Clear active PACS server',
|
|
462
|
+
' list List registered PACS servers (alias: pacs connect)',
|
|
463
|
+
' query <Key:Value...> Create PACS query and wait for results',
|
|
464
|
+
' pull <vfs-path...> Pull DICOM series into ChRIS storage',
|
|
465
|
+
],
|
|
466
|
+
examples: [
|
|
467
|
+
'pacs # Show active server',
|
|
468
|
+
'pacs connect # List all servers',
|
|
469
|
+
'pacs connect PACSDCM # Set active server by identifier',
|
|
470
|
+
'pacs connect 1 # Set active server by numeric ID',
|
|
471
|
+
'pacs disconnect # Clear active server',
|
|
472
|
+
'pacs list # List all servers',
|
|
473
|
+
'pacs query PatientID:1234 # Query PACS',
|
|
474
|
+
'pacs pull /net/pacs/queries/42_AccessionNumber:12345678',
|
|
475
|
+
],
|
|
476
|
+
},
|
|
477
|
+
'pacs query': {
|
|
478
|
+
usage: 'pacs query <Key:Value[,Key:Value...]> [--title <title>] [--pacsserver <id>]',
|
|
479
|
+
description: 'Create a PACS query, wait for results, and print the VFS path',
|
|
480
|
+
options: [
|
|
481
|
+
'--title <title> Title for the query record (default: Query <timestamp>)',
|
|
482
|
+
'--pacsserver <id> Override PACS server (default: context PACSserver)',
|
|
483
|
+
'--table Render results as a table instead of the default list',
|
|
484
|
+
'--help Show this help',
|
|
485
|
+
],
|
|
486
|
+
examples: [
|
|
487
|
+
'pacs query PatientID:1234',
|
|
488
|
+
'pacs query AccessionNumber:12345678 --title "Hip DDH workup"',
|
|
489
|
+
'pacs query PatientID:1234,StudyDate:20240101',
|
|
490
|
+
'',
|
|
491
|
+
'# Standalone alias (identical behaviour)',
|
|
492
|
+
'query PatientID:1234',
|
|
493
|
+
],
|
|
494
|
+
},
|
|
495
|
+
'pacs pull': {
|
|
496
|
+
usage: 'pacs pull [--nowait] [--retry N] <vfs-path|query-expr> [...]',
|
|
497
|
+
description: 'Pull PACS series into ChRIS storage (blocking, with LONK progress)',
|
|
498
|
+
options: [
|
|
499
|
+
'--nowait Fire retrieves and exit immediately; prints <seriesUID> <retrieveId> per line',
|
|
500
|
+
'--retry N Re-fire retrieves for [NO LONK] series up to N additional times',
|
|
501
|
+
'--help Show this help',
|
|
502
|
+
],
|
|
503
|
+
examples: [
|
|
504
|
+
'pacs pull /net/pacs/queries/42_AccessionNumber:12345678',
|
|
505
|
+
'pacs pull /net/pacs/queries/42_.../Study_1.2.3_US-Hips_DDH',
|
|
506
|
+
'pacs pull AccessionNumber:12345678 # query-then-pull shorthand',
|
|
507
|
+
'',
|
|
508
|
+
'# Standalone alias (identical behaviour)',
|
|
509
|
+
'pull /net/pacs/queries/42_AccessionNumber:12345678',
|
|
510
|
+
],
|
|
511
|
+
},
|
|
512
|
+
'pacs connect': {
|
|
513
|
+
usage: 'pacs connect [<name|id>]',
|
|
514
|
+
description: 'List registered PACS servers or set the active one',
|
|
515
|
+
examples: [
|
|
516
|
+
'pacs connect # List all servers with active marked',
|
|
517
|
+
'pacs connect PACSDCM # Set active server by identifier',
|
|
518
|
+
'pacs connect 1 # Set active server by numeric ID',
|
|
519
|
+
],
|
|
520
|
+
},
|
|
521
|
+
'pacs disconnect': {
|
|
522
|
+
usage: 'pacs disconnect',
|
|
523
|
+
description: 'Clear the active PACS server from context',
|
|
524
|
+
examples: [
|
|
525
|
+
'pacs disconnect # Clear active server',
|
|
526
|
+
],
|
|
527
|
+
},
|
|
528
|
+
'pacs list': {
|
|
529
|
+
usage: 'pacs list',
|
|
530
|
+
description: 'List registered PACS servers with active one marked (alias: pacs connect)',
|
|
531
|
+
examples: [
|
|
532
|
+
'pacs list # List all servers',
|
|
533
|
+
],
|
|
534
|
+
},
|
|
535
|
+
pacsservers: {
|
|
536
|
+
usage: 'pacsservers <subcommand> [options]',
|
|
537
|
+
description: 'List or inspect available PACS servers (context-aware)',
|
|
538
|
+
examples: [
|
|
539
|
+
'pacsservers list # List PACS servers',
|
|
540
|
+
'pacsservers list --table # Table view',
|
|
541
|
+
'pacsservers fieldslist # Show fields',
|
|
542
|
+
],
|
|
543
|
+
},
|
|
544
|
+
pacsqueries: {
|
|
545
|
+
usage: 'pacsqueries <subcommand> [options]',
|
|
546
|
+
description: 'Create or list PACS queries (uses current pacsserver context unless overridden)',
|
|
547
|
+
options: [
|
|
548
|
+
'--pacsserver <id|name> Use specific PACS server for this call',
|
|
549
|
+
'--title <string> Title for created query',
|
|
550
|
+
'--search <filters> Filters for list (supports comma-separated key:value)',
|
|
551
|
+
],
|
|
552
|
+
examples: [
|
|
553
|
+
'pacsqueries list # List for current pacsserver',
|
|
554
|
+
'pacsqueries list --pacsserver PACSDCM # Override server',
|
|
555
|
+
'pacsqueries create "PatientID:1234" --title "PID 1234"',
|
|
556
|
+
'pacsqueries decode <id> # Decode a query result',
|
|
557
|
+
],
|
|
558
|
+
},
|
|
559
|
+
pacsretrieve: {
|
|
560
|
+
usage: 'pacsretrieve <subcommand> [options]',
|
|
561
|
+
description: 'Pull or inspect DICOM retrieves for PACS queries',
|
|
562
|
+
examples: [
|
|
563
|
+
'pacsretrieve pull <queryId> # Pull data for a query',
|
|
564
|
+
'pacsretrieve report <queryId> # Show retrieve status',
|
|
565
|
+
'pacsretrieve cancel <retrieveId> # Cancel a retrieve',
|
|
566
|
+
],
|
|
567
|
+
},
|
|
568
|
+
exit: {
|
|
569
|
+
usage: 'exit',
|
|
570
|
+
description: 'Exit the shell',
|
|
571
|
+
examples: ['exit'],
|
|
572
|
+
},
|
|
573
|
+
context: {
|
|
574
|
+
usage: 'context',
|
|
575
|
+
description: 'Display current ChRIS context information',
|
|
576
|
+
examples: ['context'],
|
|
577
|
+
},
|
|
578
|
+
whoami: {
|
|
579
|
+
usage: 'whoami',
|
|
580
|
+
description: 'Print the currently authenticated ChRIS username',
|
|
581
|
+
examples: ['whoami'],
|
|
582
|
+
},
|
|
583
|
+
whereami: {
|
|
584
|
+
usage: 'whereami',
|
|
585
|
+
description: 'Print the current CUBE URL',
|
|
586
|
+
examples: ['whereami'],
|
|
587
|
+
},
|
|
588
|
+
proc: {
|
|
589
|
+
usage: 'proc <jobs|stat|feeds|refresh|find> [args]',
|
|
590
|
+
summary: 'Job history inspector — navigate, query and monitor ChRIS pipeline execution via /proc/jobs',
|
|
591
|
+
description: '/proc/jobs is a job history inspector. Every computation ever run in ChRIS is a plugin instance — a discrete job with a parent, zero or more children, a status, parameters, and a log. Jobs are grouped into feeds (pipeline runs), and the parent-child relationships form a DAG: the execution tree of a full computation. /proc/jobs exposes this as a navigable filesystem. cd into a feed to see what ran. ls -l shows job status at a glance. tree shows the full execution DAG. cat status, cat log, cat params give you CUBE data as plain text — no API queries to write, no UI to open. The in-memory cache makes this instant: built at login from the feed index, warmed in the background across all plugin instances. Once warm, all navigation, search, and path reconstruction are zero-cost in-memory operations.',
|
|
592
|
+
subcommands: [
|
|
593
|
+
'jobs list List all feeds with full counter fields (default 20)',
|
|
594
|
+
'jobs list --fields id,title,erroredJobs Select columns',
|
|
595
|
+
'jobs list --sort erroredJobs --reverse Sort by field',
|
|
596
|
+
'jobs list --table Tabular output',
|
|
597
|
+
'jobs list --csv CSV output',
|
|
598
|
+
'jobs list --all All feeds (no limit)',
|
|
599
|
+
'jobs list --search failed Filter by title substring',
|
|
600
|
+
'jobs inspect Show all available field names',
|
|
601
|
+
'stat Show cache summary',
|
|
602
|
+
'stat <feed_id> Show raw counters + topology state for one feed',
|
|
603
|
+
'feeds <title> Search feed titles; returns /proc/jobs/feed_N paths',
|
|
604
|
+
'refresh Rebuild entire proc cache',
|
|
605
|
+
'refresh <feed_id> Rebuild cache for one feed only',
|
|
606
|
+
'find <id|name> Find instance by ID or plugin name substring',
|
|
607
|
+
],
|
|
608
|
+
examples: [
|
|
609
|
+
'proc jobs list',
|
|
610
|
+
'proc jobs list --sort erroredJobs --reverse --table',
|
|
611
|
+
'proc jobs list --fields id,title,erroredJobs,startedJobs --all',
|
|
612
|
+
'proc jobs list --search failed',
|
|
613
|
+
'proc jobs inspect',
|
|
614
|
+
'proc stat',
|
|
615
|
+
'proc stat 899',
|
|
616
|
+
'proc feeds failed',
|
|
617
|
+
'proc refresh',
|
|
618
|
+
'proc find 64306',
|
|
619
|
+
'proc find pl-fshack',
|
|
620
|
+
],
|
|
621
|
+
},
|
|
622
|
+
prompt: {
|
|
623
|
+
usage: 'prompt [list | <theme>]',
|
|
624
|
+
description: 'List available prompt themes or switch the active theme',
|
|
625
|
+
options: [
|
|
626
|
+
'list Show all available themes (marks the active one)',
|
|
627
|
+
'<theme> Switch to the named theme immediately',
|
|
628
|
+
],
|
|
629
|
+
examples: [
|
|
630
|
+
'prompt # Show current theme',
|
|
631
|
+
'prompt list # List all themes',
|
|
632
|
+
'prompt default # Switch to single-line smart-truncation theme',
|
|
633
|
+
'prompt p10k # Switch to two-line Powerlevel10k-inspired theme',
|
|
634
|
+
],
|
|
635
|
+
},
|
|
636
|
+
physicalmode: {
|
|
637
|
+
usage: 'physicalmode [on|off]',
|
|
638
|
+
description: 'Toggle or display physical filesystem mode',
|
|
639
|
+
options: [
|
|
640
|
+
'on Enable physical mode (paths used directly)',
|
|
641
|
+
'off Disable physical mode (use logical-to-physical mapping)',
|
|
642
|
+
],
|
|
643
|
+
examples: [
|
|
644
|
+
'physicalmode # Show current status',
|
|
645
|
+
'physicalmode on # Enable physical mode',
|
|
646
|
+
'physicalmode off # Disable physical mode',
|
|
647
|
+
],
|
|
648
|
+
},
|
|
649
|
+
timing: {
|
|
650
|
+
usage: 'timing [on|off]',
|
|
651
|
+
description: 'Toggle or display command timing mode',
|
|
652
|
+
options: [
|
|
653
|
+
'on Enable timing display',
|
|
654
|
+
'off Disable timing display',
|
|
655
|
+
],
|
|
656
|
+
examples: [
|
|
657
|
+
'timing # Show current status',
|
|
658
|
+
'timing on # Enable timing display',
|
|
659
|
+
'timing off # Disable timing display',
|
|
660
|
+
],
|
|
661
|
+
},
|
|
662
|
+
debug: {
|
|
663
|
+
usage: 'debug [on|off]',
|
|
664
|
+
description: 'Toggle or display debug mode (verbose logging)',
|
|
665
|
+
options: [
|
|
666
|
+
'on Enable debug logging',
|
|
667
|
+
'off Disable debug logging',
|
|
668
|
+
],
|
|
669
|
+
examples: [
|
|
670
|
+
'debug # Show current status',
|
|
671
|
+
'debug on # Enable debug mode',
|
|
672
|
+
'debug off # Disable debug mode',
|
|
673
|
+
],
|
|
674
|
+
},
|
|
675
|
+
parametersofplugin: {
|
|
676
|
+
usage: 'parametersofplugin <plugin_name>',
|
|
677
|
+
description: 'Display parameters for a specific plugin',
|
|
678
|
+
examples: [
|
|
679
|
+
'parametersofplugin pl-dircopy',
|
|
680
|
+
'parametersofplugin pl-simpledsapp',
|
|
681
|
+
],
|
|
682
|
+
},
|
|
683
|
+
tree: {
|
|
684
|
+
usage: 'tree [options] [path]',
|
|
685
|
+
description: 'Display directory tree structure',
|
|
686
|
+
options: [
|
|
687
|
+
'--follow Follow symbolic links when traversing',
|
|
688
|
+
'--path Emit one full path per entry (grep-friendly, no tree art)',
|
|
689
|
+
],
|
|
690
|
+
examples: [
|
|
691
|
+
'tree # Tree of current directory',
|
|
692
|
+
'tree /home/user/data # Tree of specific path',
|
|
693
|
+
'tree --follow # Follow symbolic links',
|
|
694
|
+
'tree --path # One path per line, no decoration',
|
|
695
|
+
],
|
|
696
|
+
},
|
|
697
|
+
du: {
|
|
698
|
+
usage: 'du [options] [path]',
|
|
699
|
+
description: 'Display disk usage statistics (mimics Linux du)',
|
|
700
|
+
options: [
|
|
701
|
+
'-h, --human-readable Print sizes in human readable format',
|
|
702
|
+
'-s, --summarize Display only total for each argument',
|
|
703
|
+
'-a, --all Show counts for all files, not just directories',
|
|
704
|
+
'-c, --total Produce a grand total',
|
|
705
|
+
'-d N, --max-depth=N Print total only if N or fewer levels below',
|
|
706
|
+
'-S, --separate-dirs Do not include size of subdirectories',
|
|
707
|
+
],
|
|
708
|
+
examples: [
|
|
709
|
+
'du # Disk usage of current directory',
|
|
710
|
+
'du -h # Human-readable sizes (1K, 234M, 2G)',
|
|
711
|
+
'du -s /home/user/data # Summary only for specified path',
|
|
712
|
+
'du -a # Show all files, not just directories',
|
|
713
|
+
'du -c # Show grand total at end',
|
|
714
|
+
'du -d 2 # Max depth of 2 levels',
|
|
715
|
+
'du -sh # Human-readable summary',
|
|
716
|
+
],
|
|
717
|
+
},
|
|
718
|
+
store: {
|
|
719
|
+
usage: 'store <subcommand> [options]',
|
|
720
|
+
description: 'Browse, search, and install plugins from ChRIS peer store',
|
|
721
|
+
options: [
|
|
722
|
+
'',
|
|
723
|
+
'NOTE: The Store is an external peer ChRIS instance, not a local CUBE resource.',
|
|
724
|
+
' Standard resource options (--all, --limit, etc.) do not apply.',
|
|
725
|
+
'',
|
|
726
|
+
'SUBCOMMANDS:',
|
|
727
|
+
' list Browse all plugins in the peer store',
|
|
728
|
+
' search <query> Search plugins by name',
|
|
729
|
+
' install <name> Install a plugin from the store into local CUBE',
|
|
730
|
+
' inspect Show current peer store URL and connection info',
|
|
731
|
+
' set <url> Set peer store URL (persisted to ~/.config/chell/settings.json)',
|
|
732
|
+
' reset Reset peer store URL to default (cube.chrisproject.org)',
|
|
733
|
+
'',
|
|
734
|
+
'INSTALL OPTIONS:',
|
|
735
|
+
' --compute <names> Compute resources (comma-separated)',
|
|
736
|
+
' --adminUser <user> Admin username for install',
|
|
737
|
+
' --adminPassword <pw> Admin password for install',
|
|
738
|
+
'-l Long listing format',
|
|
739
|
+
],
|
|
740
|
+
examples: [
|
|
741
|
+
'store list',
|
|
742
|
+
'store search dicom',
|
|
743
|
+
'store install pl-dcm2niix',
|
|
744
|
+
'store install pl-dcm2niix-v1.2.3',
|
|
745
|
+
'store install fnndsc/pl-dcm2niix:1.2.3',
|
|
746
|
+
'store install pl-dcm2niix --compute moc',
|
|
747
|
+
'store inspect',
|
|
748
|
+
'store set https://my-cube.org/api/v1/',
|
|
749
|
+
'store reset',
|
|
750
|
+
],
|
|
751
|
+
},
|
|
752
|
+
compute: {
|
|
753
|
+
usage: 'compute <subcommand> [options]',
|
|
754
|
+
description: 'Manage ChRIS compute resources',
|
|
755
|
+
options: [
|
|
756
|
+
...RESOURCE_LIST_OPTIONS,
|
|
757
|
+
],
|
|
758
|
+
examples: [
|
|
759
|
+
'compute list',
|
|
760
|
+
'compute list --table',
|
|
761
|
+
'compute list --csv',
|
|
762
|
+
'compute inspect',
|
|
763
|
+
],
|
|
764
|
+
},
|
|
765
|
+
tag: {
|
|
766
|
+
usage: 'tags <subcommand> [options]',
|
|
767
|
+
description: 'Manage ChRIS tags',
|
|
768
|
+
options: [
|
|
769
|
+
...RESOURCE_LIST_OPTIONS,
|
|
770
|
+
'',
|
|
771
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
772
|
+
' create <name> Create a new tag',
|
|
773
|
+
' update <id> <name> Rename a tag',
|
|
774
|
+
' delete <id> Remove a tag',
|
|
775
|
+
],
|
|
776
|
+
examples: ['tags list', 'tags search brain', 'tags inspect', 'tag create neuro', 'tag delete 5'],
|
|
777
|
+
},
|
|
778
|
+
tags: {
|
|
779
|
+
usage: 'tags <subcommand> [options]',
|
|
780
|
+
description: 'Manage ChRIS tags',
|
|
781
|
+
options: [
|
|
782
|
+
...RESOURCE_LIST_OPTIONS,
|
|
783
|
+
'',
|
|
784
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
785
|
+
' create <name> Create a new tag',
|
|
786
|
+
' update <id> <name> Rename a tag',
|
|
787
|
+
' delete <id> Remove a tag',
|
|
788
|
+
],
|
|
789
|
+
examples: ['tags list', 'tags search brain', 'tags inspect', 'tag create neuro', 'tag delete 5'],
|
|
790
|
+
},
|
|
791
|
+
group: {
|
|
792
|
+
usage: 'groups <subcommand> [options]',
|
|
793
|
+
description: 'Manage ChRIS user groups',
|
|
794
|
+
options: [
|
|
795
|
+
...RESOURCE_LIST_OPTIONS,
|
|
796
|
+
'',
|
|
797
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
798
|
+
' members <id> List users in a group',
|
|
799
|
+
' create <name> [admin] Create a new group',
|
|
800
|
+
' delete <id> [admin] Remove a group',
|
|
801
|
+
' adduser <id> <user> [admin] Add user to group',
|
|
802
|
+
' removeuser <id> <user> [admin] Remove user from group',
|
|
803
|
+
],
|
|
804
|
+
examples: ['groups list', 'groups search all_users', 'groups inspect', 'group members 3'],
|
|
805
|
+
},
|
|
806
|
+
groups: {
|
|
807
|
+
usage: 'groups <subcommand> [options]',
|
|
808
|
+
description: 'Manage ChRIS user groups',
|
|
809
|
+
options: [
|
|
810
|
+
...RESOURCE_LIST_OPTIONS,
|
|
811
|
+
'',
|
|
812
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
813
|
+
' members <id> List users in a group',
|
|
814
|
+
' create <name> [admin] Create a new group',
|
|
815
|
+
' delete <id> [admin] Remove a group',
|
|
816
|
+
' adduser <id> <user> [admin] Add user to group',
|
|
817
|
+
' removeuser <id> <user> [admin] Remove user from group',
|
|
818
|
+
],
|
|
819
|
+
examples: ['groups list', 'groups search all_users', 'groups inspect', 'group members 3'],
|
|
820
|
+
},
|
|
821
|
+
pluginmeta: {
|
|
822
|
+
usage: 'pluginmetas <subcommand> [options]',
|
|
823
|
+
description: 'Browse ChRIS plugin metadata (abstract tool identities across versions)',
|
|
824
|
+
options: [
|
|
825
|
+
...RESOURCE_LIST_OPTIONS,
|
|
826
|
+
'',
|
|
827
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
828
|
+
' plugins <id> List all registered versions of a plugin meta',
|
|
829
|
+
],
|
|
830
|
+
examples: ['pluginmetas list', 'pluginmetas search dircopy', 'pluginmetas inspect', 'pluginmeta plugins 12'],
|
|
831
|
+
},
|
|
832
|
+
pluginmetas: {
|
|
833
|
+
usage: 'pluginmetas <subcommand> [options]',
|
|
834
|
+
description: 'Browse ChRIS plugin metadata (abstract tool identities across versions)',
|
|
835
|
+
options: [
|
|
836
|
+
...RESOURCE_LIST_OPTIONS,
|
|
837
|
+
'',
|
|
838
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
839
|
+
' plugins <id> List all registered versions of a plugin meta',
|
|
840
|
+
],
|
|
841
|
+
examples: ['pluginmetas list', 'pluginmetas search dircopy', 'pluginmetas inspect', 'pluginmeta plugins 12'],
|
|
842
|
+
},
|
|
843
|
+
plugininstance: {
|
|
844
|
+
usage: 'plugininstances <subcommand> [options]',
|
|
845
|
+
description: 'Manage ChRIS plugin instances (jobs)',
|
|
846
|
+
options: [
|
|
847
|
+
...RESOURCE_LIST_OPTIONS,
|
|
848
|
+
'',
|
|
849
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
850
|
+
' cancel <id> Cancel a running job',
|
|
851
|
+
' delete <id> Remove a job',
|
|
852
|
+
' output <id> Show output folder path',
|
|
853
|
+
' parameters <id> List job parameters',
|
|
854
|
+
],
|
|
855
|
+
examples: ['jobs list', 'jobs list --all', 'jobs search status:started', 'jobs inspect', 'job cancel 42', 'job output 42'],
|
|
856
|
+
},
|
|
857
|
+
plugininstances: {
|
|
858
|
+
usage: 'plugininstances <subcommand> [options]',
|
|
859
|
+
description: 'Manage ChRIS plugin instances (jobs)',
|
|
860
|
+
options: [
|
|
861
|
+
...RESOURCE_LIST_OPTIONS,
|
|
862
|
+
'',
|
|
863
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
864
|
+
' cancel <id> Cancel a running job',
|
|
865
|
+
' delete <id> Remove a job',
|
|
866
|
+
' output <id> Show output folder path',
|
|
867
|
+
' parameters <id> List job parameters',
|
|
868
|
+
],
|
|
869
|
+
examples: ['jobs list', 'jobs list --all', 'jobs search status:started', 'jobs inspect', 'job cancel 42', 'job output 42'],
|
|
870
|
+
},
|
|
871
|
+
workflow: {
|
|
872
|
+
usage: 'workflows <subcommand> [options]',
|
|
873
|
+
description: 'Manage ChRIS workflows (pipeline executions)',
|
|
874
|
+
options: [
|
|
875
|
+
...RESOURCE_LIST_OPTIONS,
|
|
876
|
+
'',
|
|
877
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
878
|
+
' run Run a pipeline (alias: pipeline run)',
|
|
879
|
+
' jobs <id> List plugin instances created by this workflow',
|
|
880
|
+
' rename <id> <title> Rename a workflow',
|
|
881
|
+
' delete <id> Remove a workflow',
|
|
882
|
+
],
|
|
883
|
+
examples: ['workflows list', 'workflows list --all', 'workflows inspect', 'workflow jobs 7', 'workflow delete 7'],
|
|
884
|
+
},
|
|
885
|
+
workflows: {
|
|
886
|
+
usage: 'workflows <subcommand> [options]',
|
|
887
|
+
description: 'Manage ChRIS workflows (pipeline executions)',
|
|
888
|
+
options: [
|
|
889
|
+
...RESOURCE_LIST_OPTIONS,
|
|
890
|
+
'',
|
|
891
|
+
'RESOURCE-SPECIFIC SUBCOMMANDS:',
|
|
892
|
+
' run Run a pipeline (alias: pipeline run)',
|
|
893
|
+
' jobs <id> List plugin instances created by this workflow',
|
|
894
|
+
' rename <id> <title> Rename a workflow',
|
|
895
|
+
' delete <id> Remove a workflow',
|
|
896
|
+
],
|
|
897
|
+
examples: ['workflows list', 'workflows list --all', 'workflows inspect', 'workflow jobs 7', 'workflow delete 7'],
|
|
898
|
+
},
|
|
899
|
+
meta: { usage: 'pluginmetas <subcommand> [options]', description: 'Alias for pluginmeta/pluginmetas', options: [...RESOURCE_LIST_OPTIONS], examples: ['metas list', 'meta inspect'] },
|
|
900
|
+
metas: { usage: 'pluginmetas <subcommand> [options]', description: 'Alias for pluginmeta/pluginmetas', options: [...RESOURCE_LIST_OPTIONS], examples: ['metas list', 'meta inspect'] },
|
|
901
|
+
instance: { usage: 'plugininstances <subcommand> [options]', description: 'Alias for plugininstance/plugininstances/job/jobs', options: [...RESOURCE_LIST_OPTIONS], examples: ['instances list', 'instance cancel 42'] },
|
|
902
|
+
instances: { usage: 'plugininstances <subcommand> [options]', description: 'Alias for plugininstance/plugininstances/job/jobs', options: [...RESOURCE_LIST_OPTIONS], examples: ['instances list', 'instance cancel 42'] },
|
|
903
|
+
job: { usage: 'plugininstances <subcommand> [options]', description: 'Alias for plugininstance/plugininstances', options: [...RESOURCE_LIST_OPTIONS], examples: ['jobs list', 'job cancel 42', 'job output 42'] },
|
|
904
|
+
jobs: { usage: 'plugininstances <subcommand> [options]', description: 'Alias for plugininstance/plugininstances', options: [...RESOURCE_LIST_OPTIONS], examples: ['jobs list', 'job cancel 42', 'job output 42'] },
|
|
905
|
+
help: {
|
|
906
|
+
usage: 'help [command]',
|
|
907
|
+
description: 'Display help information',
|
|
908
|
+
examples: [
|
|
909
|
+
'help # List all commands',
|
|
910
|
+
'help ls # Show help for ls',
|
|
911
|
+
'help timing # Show help for timing',
|
|
912
|
+
],
|
|
913
|
+
},
|
|
914
|
+
'!': {
|
|
915
|
+
usage: '! <shell_command>',
|
|
916
|
+
description: 'Execute command on host shell (shell escape)',
|
|
917
|
+
examples: [
|
|
918
|
+
'! ls # List files on host system',
|
|
919
|
+
'! pwd # Print host working directory',
|
|
920
|
+
'! cat /etc/hostname # Read host file',
|
|
921
|
+
'! df -h # Check host disk usage',
|
|
922
|
+
'! echo "test" > /tmp/file.txt # Write to host file',
|
|
923
|
+
],
|
|
924
|
+
},
|
|
925
|
+
cubepath: {
|
|
926
|
+
usage: 'cubepath <vfs-path> [--pacsserver <id>]',
|
|
927
|
+
description: 'Show CUBE FS path and file count for each series under a PACS VFS path. Zero files = not pulled.',
|
|
928
|
+
options: [
|
|
929
|
+
'--pacsserver <id> Override PACS server (default: context PACSserver)',
|
|
930
|
+
'--help Show this help',
|
|
931
|
+
],
|
|
932
|
+
examples: [
|
|
933
|
+
'# All series under a query',
|
|
934
|
+
'cubepath /net/pacs/queries/AccessionNumber:12345678_qid:2661',
|
|
935
|
+
'',
|
|
936
|
+
'# All series under a study',
|
|
937
|
+
'cubepath /net/pacs/queries/AccessionNumber:12345678_qid:2661/Study_1.2.3_Brain_MRI',
|
|
938
|
+
'',
|
|
939
|
+
'# Single series',
|
|
940
|
+
'cubepath /net/pacs/queries/AccessionNumber:12345678_qid:2661/Study_1.2.3/Series_1.2.3.4_AX_T2',
|
|
941
|
+
],
|
|
942
|
+
},
|
|
943
|
+
query: {
|
|
944
|
+
usage: 'query <Key:Value[,Key:Value...]> [--title <title>] [--pacsserver <id>]',
|
|
945
|
+
description: 'Create a PACS query, wait for results, and print the VFS path',
|
|
946
|
+
options: [
|
|
947
|
+
'--title <title> Title for the query record (default: Query <timestamp>)',
|
|
948
|
+
'--pacsserver <id> Override PACS server (default: context PACSserver)',
|
|
949
|
+
'--table Render results as a table instead of the default list',
|
|
950
|
+
'--help Show this help',
|
|
951
|
+
],
|
|
952
|
+
examples: [
|
|
953
|
+
'query PatientID:1234',
|
|
954
|
+
'query AccessionNumber:12345678 --title "Hip DDH workup"',
|
|
955
|
+
'query PatientID:1234,StudyDate:20240101',
|
|
956
|
+
'',
|
|
957
|
+
'# Use output path directly with pull',
|
|
958
|
+
'pull $(query PatientID:1234 | grep "VFS path" | awk \'{print $3}\')',
|
|
959
|
+
],
|
|
960
|
+
},
|
|
961
|
+
pull: {
|
|
962
|
+
usage: 'pull [--nowait] <vfs-path|query-expr> [...]',
|
|
963
|
+
description: 'Pull PACS series into ChRIS storage; accepts VFS paths or query expressions (blocking)',
|
|
964
|
+
options: [
|
|
965
|
+
'--nowait Fire retrieves and exit immediately; prints <seriesUID> <retrieveId> per line',
|
|
966
|
+
'--retry N Re-fire retrieves for [NO LONK] series up to N additional times',
|
|
967
|
+
'--help Show this help',
|
|
968
|
+
],
|
|
969
|
+
examples: [
|
|
970
|
+
'# Pull all series in a query (blocking)',
|
|
971
|
+
'pull /net/pacs/queries/42_AccessionNumber:12345678',
|
|
972
|
+
'',
|
|
973
|
+
'# Pull a single study',
|
|
974
|
+
'pull /net/pacs/queries/42_AccessionNumber:12345678/Study_1.2.3_US-Hips_DDH',
|
|
975
|
+
'',
|
|
976
|
+
'# Pull a specific series',
|
|
977
|
+
'pull /net/pacs/queries/42_AccessionNumber:12345678/Study_1.2.3_US-Hips_DDH/Series_1.2.3.4_XR',
|
|
978
|
+
'',
|
|
979
|
+
'# Pull multiple paths in one blocking call',
|
|
980
|
+
'pull /net/pacs/queries/42_AccessionNumber:12345678 /net/pacs/queries/43_PatientID:P001',
|
|
981
|
+
'',
|
|
982
|
+
'# Pull directly from a query expression (creates query, waits, then pulls)',
|
|
983
|
+
'pull PatientID:1234',
|
|
984
|
+
'pull AccessionNumber:12345678',
|
|
985
|
+
'',
|
|
986
|
+
'# Fire-and-forget (scripted)',
|
|
987
|
+
'pull --nowait /net/pacs/queries/42_AccessionNumber:12345678',
|
|
988
|
+
'# Output: <seriesUID> <retrieveId> (one per series, in tree-walk order)',
|
|
989
|
+
],
|
|
990
|
+
},
|
|
991
|
+
};
|
|
992
|
+
/**
|
|
993
|
+
* Displays help text for a command.
|
|
994
|
+
*
|
|
995
|
+
* @param command - The command to display help for.
|
|
996
|
+
*/
|
|
997
|
+
/**
|
|
998
|
+
* Formats and returns the detailed help text for a specific command as a string.
|
|
999
|
+
*
|
|
1000
|
+
* @param command - The command name to retrieve help for.
|
|
1001
|
+
/**
|
|
1002
|
+
* Word-wraps a flat string to fit within a given width, with uniform indentation.
|
|
1003
|
+
*
|
|
1004
|
+
* @param str - Input text (single line or freeform).
|
|
1005
|
+
* @param width - Total line width including indent (default 78).
|
|
1006
|
+
* @param indent - Leading spaces on every line (default 2).
|
|
1007
|
+
* @returns Multi-line string, each line at most `width` chars wide.
|
|
1008
|
+
*/
|
|
1009
|
+
export function text_boxFormat(str, width = 78, indent = 2) {
|
|
1010
|
+
const prefix = ' '.repeat(indent);
|
|
1011
|
+
const maxContent = Math.max(1, width - indent);
|
|
1012
|
+
const words = str.split(/\s+/).filter(Boolean);
|
|
1013
|
+
const lines = [];
|
|
1014
|
+
let current = '';
|
|
1015
|
+
for (const word of words) {
|
|
1016
|
+
if (current.length === 0) {
|
|
1017
|
+
current = word;
|
|
1018
|
+
}
|
|
1019
|
+
else if (current.length + 1 + word.length <= maxContent) {
|
|
1020
|
+
current += ' ' + word;
|
|
1021
|
+
}
|
|
1022
|
+
else {
|
|
1023
|
+
lines.push(prefix + current);
|
|
1024
|
+
current = word;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
if (current.length > 0)
|
|
1028
|
+
lines.push(prefix + current);
|
|
1029
|
+
return lines.join('\n');
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* @returns The formatted help text string, or undefined if no help exists.
|
|
1033
|
+
*/
|
|
1034
|
+
export function commandHelp_get(command) {
|
|
1035
|
+
const help = helpText[command];
|
|
1036
|
+
if (!help) {
|
|
1037
|
+
return undefined;
|
|
1038
|
+
}
|
|
1039
|
+
const lines = [];
|
|
1040
|
+
lines.push('');
|
|
1041
|
+
lines.push(chalk.bold.magenta(command.toUpperCase()));
|
|
1042
|
+
lines.push(chalk.gray('─'.repeat(60)));
|
|
1043
|
+
lines.push('');
|
|
1044
|
+
lines.push(chalk.bold.blue('USAGE'));
|
|
1045
|
+
const usageParts = help.usage.split(' ');
|
|
1046
|
+
const cmdName = usageParts[0];
|
|
1047
|
+
const args = usageParts.slice(1).join(' ');
|
|
1048
|
+
lines.push(` ${chalk.green(cmdName)} ${chalk.cyan(args)}`);
|
|
1049
|
+
lines.push('');
|
|
1050
|
+
lines.push(chalk.bold.blue('DESCRIPTION'));
|
|
1051
|
+
text_boxFormat(help.description, 78, 2).split('\n').forEach((l) => lines.push(l));
|
|
1052
|
+
if (help.subcommands && help.subcommands.length > 0) {
|
|
1053
|
+
lines.push('');
|
|
1054
|
+
lines.push(chalk.bold.blue('SUBCOMMANDS'));
|
|
1055
|
+
help.subcommands.forEach((opt) => {
|
|
1056
|
+
const trimmed = opt.trim();
|
|
1057
|
+
if (!trimmed) {
|
|
1058
|
+
lines.push('');
|
|
1059
|
+
return;
|
|
1060
|
+
}
|
|
1061
|
+
lines.push(` ${trimmed}`);
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
if (help.options && help.options.length > 0) {
|
|
1065
|
+
lines.push('');
|
|
1066
|
+
lines.push(chalk.bold.blue('OPTIONS'));
|
|
1067
|
+
help.options.forEach((opt) => {
|
|
1068
|
+
const trimmed = opt.trim();
|
|
1069
|
+
if (!trimmed) {
|
|
1070
|
+
lines.push('');
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
// Check if it's a header (ends with :)
|
|
1074
|
+
if (trimmed.endsWith(':')) {
|
|
1075
|
+
lines.push(` ${chalk.bold.white(trimmed)}`);
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
// Try to split by double space (common separator in help definitions)
|
|
1079
|
+
const splitMatch = opt.match(/^(\s*)(.*?)(\s{2,})(.*)$/);
|
|
1080
|
+
if (splitMatch) {
|
|
1081
|
+
const [, indent, content, separator, description] = splitMatch;
|
|
1082
|
+
lines.push(` ${indent}${chalk.yellow(content)}${separator}${description}`);
|
|
1083
|
+
}
|
|
1084
|
+
else {
|
|
1085
|
+
// Fallback: check if it starts with -
|
|
1086
|
+
if (trimmed.startsWith('-')) {
|
|
1087
|
+
lines.push(` ${chalk.yellow(opt)}`);
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
lines.push(` ${opt}`);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
if (help.examples && help.examples.length > 0) {
|
|
1096
|
+
lines.push('');
|
|
1097
|
+
lines.push(chalk.bold.blue('EXAMPLES'));
|
|
1098
|
+
help.examples.forEach((ex) => {
|
|
1099
|
+
const commentIdx = ex.indexOf('#');
|
|
1100
|
+
if (commentIdx !== -1) {
|
|
1101
|
+
const cmdPart = ex.substring(0, commentIdx);
|
|
1102
|
+
const commentPart = ex.substring(commentIdx);
|
|
1103
|
+
lines.push(` ${chalk.white(cmdPart)}${chalk.gray(commentPart)}`);
|
|
1104
|
+
}
|
|
1105
|
+
else {
|
|
1106
|
+
lines.push(` ${chalk.white(ex)}`);
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
lines.push('');
|
|
1111
|
+
return lines.join('\n');
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Displays help text for a command.
|
|
1115
|
+
*
|
|
1116
|
+
* @param command - The command to display help for.
|
|
1117
|
+
*/
|
|
1118
|
+
export function help_show(command) {
|
|
1119
|
+
const helpStr = commandHelp_get(command);
|
|
1120
|
+
if (helpStr !== undefined) {
|
|
1121
|
+
console.log(helpStr);
|
|
1122
|
+
}
|
|
1123
|
+
else {
|
|
1124
|
+
console.log(chalk.yellow(`No help available for '${command}'`));
|
|
1125
|
+
console.log(chalk.gray('Type "help" to see all available commands.'));
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Checks if arguments contain --help flag.
|
|
1130
|
+
* -h is treated as help unless the command uses it for "human-readable" (ls, du).
|
|
1131
|
+
*
|
|
1132
|
+
* @param args - Command arguments.
|
|
1133
|
+
* @param command - The command name (optional).
|
|
1134
|
+
* @returns True if help is requested.
|
|
1135
|
+
*/
|
|
1136
|
+
export function args_checkHasHelpFlag(args, command) {
|
|
1137
|
+
const isPluginExecutable = !!command && /-v.+$/.test(command);
|
|
1138
|
+
if (!isPluginExecutable && args.includes('--help'))
|
|
1139
|
+
return true;
|
|
1140
|
+
// Commands where -h means human-readable sizes, not help
|
|
1141
|
+
const humanReadableCommands = ['ls', 'du'];
|
|
1142
|
+
if (command && humanReadableCommands.includes(command)) {
|
|
1143
|
+
return false;
|
|
1144
|
+
}
|
|
1145
|
+
if (isPluginExecutable) {
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1148
|
+
return args.includes('-h');
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Builtin help command - displays command list or specific command help.
|
|
1152
|
+
*
|
|
1153
|
+
* @param args - Command arguments (optional command name).
|
|
1154
|
+
*/
|
|
1155
|
+
export async function builtin_help(args) {
|
|
1156
|
+
const commandName = args.length > 0 ? args.join(' ') : undefined;
|
|
1157
|
+
// If a specific command is requested, show its help
|
|
1158
|
+
if (commandName) {
|
|
1159
|
+
help_show(commandName);
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
// Otherwise, list all available commands
|
|
1163
|
+
console.log('');
|
|
1164
|
+
console.log(chalk.bold.cyan('ChELL - Available Commands'));
|
|
1165
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
1166
|
+
console.log('');
|
|
1167
|
+
// Group commands by category
|
|
1168
|
+
const categories = {
|
|
1169
|
+
Navigation: ['cd', 'pwd', 'ls', 'tree', 'du'],
|
|
1170
|
+
'File Operations': ['cat', 'edit', 'cp', 'mv', 'rm', 'touch', 'mkdir', 'upload', 'download'],
|
|
1171
|
+
Connection: ['connect', 'logout', 'context', 'whoami', 'whereami'],
|
|
1172
|
+
Monitoring: ['proc'],
|
|
1173
|
+
'Single Resource': ['plugin', 'pipeline', 'feed', 'tag', 'group', 'pluginmeta', 'plugininstance', 'workflow'],
|
|
1174
|
+
'Resource Collections': ['plugins', 'feeds', 'files', 'links', 'dirs', 'store', 'compute', 'tags', 'groups', 'pluginmetas', 'plugininstances', 'workflows', 'parametersofplugin'],
|
|
1175
|
+
PACS: ['pacs', 'pacsservers', 'pacsqueries', 'pacsretrieve'],
|
|
1176
|
+
'Shell Settings': ['physicalmode', 'prompt', 'timing', 'debug'],
|
|
1177
|
+
General: ['help', 'exit', '!'],
|
|
1178
|
+
};
|
|
1179
|
+
// Display commands by category
|
|
1180
|
+
for (const [category, commands] of Object.entries(categories)) {
|
|
1181
|
+
console.log(chalk.bold.yellow(category));
|
|
1182
|
+
commands.forEach((cmd) => {
|
|
1183
|
+
const help = helpText[cmd];
|
|
1184
|
+
if (help) {
|
|
1185
|
+
console.log(` ${chalk.cyan(cmd.padEnd(20))} ${chalk.gray(help.summary ?? help.description)}`);
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
console.log('');
|
|
1189
|
+
}
|
|
1190
|
+
// Display Shell Features
|
|
1191
|
+
console.log(chalk.bold.yellow('Shell Features'));
|
|
1192
|
+
console.log(` ${chalk.cyan('Pipes'.padEnd(20))} ${chalk.gray('Chain commands: cat file.txt | wc -l')}`);
|
|
1193
|
+
console.log(` ${chalk.cyan('Redirection >'.padEnd(20))} ${chalk.gray('Write to file: cat file.txt > output.txt')}`);
|
|
1194
|
+
console.log(` ${chalk.cyan('Redirection >>'.padEnd(20))} ${chalk.gray('Append to file: cat file.txt >> output.txt')}`);
|
|
1195
|
+
console.log('');
|
|
1196
|
+
console.log(chalk.gray('Type "help <command>" for detailed information about a command.'));
|
|
1197
|
+
console.log(chalk.gray('Type "<command> --help" for quick help on any command.'));
|
|
1198
|
+
console.log('');
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Gets the list of all builtin command names.
|
|
1202
|
+
*
|
|
1203
|
+
* @returns Array of builtin command names.
|
|
1204
|
+
*/
|
|
1205
|
+
export function builtinCommands_list() {
|
|
1206
|
+
return Object.keys(helpText);
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Gets the description for a builtin command.
|
|
1210
|
+
*
|
|
1211
|
+
* @param command - The command name.
|
|
1212
|
+
* @returns The command description, or undefined if not found.
|
|
1213
|
+
*/
|
|
1214
|
+
export function builtinCommand_descriptionGet(command) {
|
|
1215
|
+
return helpText[command]?.description;
|
|
1216
|
+
}
|
|
1217
|
+
//# sourceMappingURL=help.js.map
|