@fnndsc/brasa 0.56.2 → 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/berthCube.d.ts +3 -2
- package/dist/builtins/berth/berthCube.js +5 -10
- package/dist/builtins/berth/berthCube.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 +89 -10
- 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 +120 -55
- package/dist/builtins/fs/cp.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/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 +86 -22
- 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 +38 -2
- package/dist/builtins/help.js +76 -769
- 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 +52 -3
- package/dist/builtins/res/dicom.js +82 -34
- 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 +718 -263
- 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 +0 -37
- package/dist/builtins/utils.js +0 -86
- package/dist/builtins/utils.js.map +1 -1
- package/dist/chris/chrisCommands.js +58 -152
- 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/filesystem.js +7 -5
- package/dist/chris/filesystem.js.map +1 -1
- package/dist/chris/help.js +0 -1018
- package/dist/chris/help.js.map +1 -1
- package/dist/chris/kinds.d.ts +21 -0
- package/dist/chris/kinds.js +114 -2
- package/dist/chris/kinds.js.map +1 -1
- 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/core/commandDeclaration.d.ts +97 -7
- package/dist/core/commandDeclaration.js +21 -0
- package/dist/core/commandDeclaration.js.map +1 -1
- package/dist/core/commandParse.js +65 -17
- package/dist/core/commandParse.js.map +1 -1
- package/dist/core/commandRegistry.d.ts +4 -3
- package/dist/core/commandRegistry.js +36 -8
- package/dist/core/commandRegistry.js.map +1 -1
- package/dist/core/commandSchema.js +5 -2
- package/dist/core/commandSchema.js.map +1 -1
- package/dist/core/commandUsage.d.ts +15 -0
- package/dist/core/commandUsage.js +59 -7
- package/dist/core/commandUsage.js.map +1 -1
- package/dist/core/coreCommands.js +63 -212
- package/dist/core/coreCommands.js.map +1 -1
- package/dist/core/paths.d.ts +29 -1
- package/dist/core/paths.js +15 -2
- package/dist/core/paths.js.map +1 -1
- package/dist/core/preprocess.d.ts +3 -4
- package/dist/core/preprocess.js +4 -5
- package/dist/core/preprocess.js.map +1 -1
- package/dist/lib/completer/declared.js +7 -4
- package/dist/lib/completer/declared.js.map +1 -1
- package/dist/lib/completer/index.js +2 -7
- package/dist/lib/completer/index.js.map +1 -1
- package/dist/lib/parser.d.ts +0 -8
- package/dist/lib/parser.js +0 -11
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/vfs/vfs.d.ts +2 -1
- package/dist/lib/vfs/vfs.js +5 -4
- package/dist/lib/vfs/vfs.js.map +1 -1
- package/dist/notes.json +1 -1
- package/package.json +3 -3
|
@@ -1,62 +1,451 @@
|
|
|
1
|
-
import { CommandEnvelope } from '@fnndsc/menu';
|
|
2
|
-
/**
|
|
1
|
+
import { type CommandEnvelope } from '@fnndsc/menu';
|
|
2
|
+
/**
|
|
3
|
+
* One text a filter reads: the pipe's, or a file's under its name.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const source: FilterSource = { name: 'notes.txt', text: 'a\nb\n' };
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
3
10
|
export interface FilterSource {
|
|
4
11
|
/** The operand as typed; null for the pipe. */
|
|
5
12
|
name: string | null;
|
|
13
|
+
/** What it holds. */
|
|
6
14
|
text: string;
|
|
7
15
|
}
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The file operand every filter but `uniq` takes.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const GRAMMAR = { operands: [FILES_OPERAND] } as const satisfies CommandGrammar;
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const FILES_OPERAND: {
|
|
25
|
+
readonly name: "files";
|
|
26
|
+
readonly kind: "cfsPath";
|
|
27
|
+
readonly optional: true;
|
|
28
|
+
readonly repeat: true;
|
|
29
|
+
readonly glob: true;
|
|
30
|
+
readonly summary: "ChRIS files to read, in order (a wildcard matches paths; - is the pipe); the pipe when none is named";
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The lines of a text, without the last line's newline.
|
|
34
|
+
*
|
|
35
|
+
* @param text - The text.
|
|
36
|
+
* @returns Its lines; none for the empty text.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* lines_split('a\nb\n'); // ['a', 'b']
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function lines_split(text: string): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Lines written back as text, each ended by a newline.
|
|
46
|
+
*
|
|
47
|
+
* @param lines - The lines.
|
|
48
|
+
* @returns The text; empty for no lines.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* lines_join(['a', 'b']); // 'a\nb\n'
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function lines_join(lines: ReadonlyArray<string>): string;
|
|
56
|
+
/**
|
|
57
|
+
* A word as a POSIX shell reads it back.
|
|
58
|
+
*
|
|
59
|
+
* @param word - The word.
|
|
60
|
+
* @returns The word, quoted when the shell would read it otherwise.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* word_quote("it's"); // "'it'\\''s'"
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function word_quote(word: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* What a filter read: the sources, in order, and what could not be read.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const read: FilterRead = { sources: [{ name: 'a.txt', text: 'a\n' }], errors: 'wc: b.txt: no such file\n' };
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export interface FilterRead {
|
|
77
|
+
/** The texts read. */
|
|
78
|
+
sources: FilterSource[];
|
|
79
|
+
/** A line per operand that could not be read; empty when all were. */
|
|
80
|
+
errors: string;
|
|
16
81
|
}
|
|
17
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Reads one ChRIS file through the one store-path resolver, under its name as typed.
|
|
84
|
+
*
|
|
85
|
+
* @param command - The filter's name, for what it says.
|
|
86
|
+
* @param operand - The path as typed.
|
|
87
|
+
* @returns The source, or the line that says why it could not be read.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* await filterFile_read('wc', 'notes.txt'); // { name: 'notes.txt', text: '…' }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function filterFile_read(command: string, operand: string): Promise<FilterSource | {
|
|
95
|
+
error: string;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Reads what a filter works on: the files named, in order (`-` is the
|
|
99
|
+
* pipe), else what was piped in.
|
|
100
|
+
*
|
|
101
|
+
* @param command - The filter's name, for what it says.
|
|
102
|
+
* @param operands - The file operands.
|
|
103
|
+
* @returns The sources and what could not be read, or a refusal when there is nothing at all.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* await filterSources_read('wc', ['a.txt', '-']);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare function filterSources_read(command: string, operands: ReadonlyArray<string>): Promise<FilterRead | {
|
|
111
|
+
refusal: string;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* A filter's answer over what it read: the output, with what could not be
|
|
115
|
+
* read on the error channel (exit 1).
|
|
116
|
+
*
|
|
117
|
+
* @param read - What was read.
|
|
118
|
+
* @param answer - Turns the sources into the filter's output.
|
|
119
|
+
* @returns The envelope.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* filterRead_answer(read, (sources: FilterSource[]): string => wc_render(ask, sources));
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare function filterRead_answer(read: FilterRead, answer: (sources: FilterSource[]) => string): CommandEnvelope;
|
|
127
|
+
/**
|
|
128
|
+
* Runs a filter: reads its sources and answers them; a file it cannot read
|
|
129
|
+
* is said by name, and the others are still answered.
|
|
130
|
+
*
|
|
131
|
+
* @param command - The filter's name.
|
|
132
|
+
* @param files - The file operands (`-` is the pipe); none for the pipe alone.
|
|
133
|
+
* @param answer - Turns the sources into the filter's output.
|
|
134
|
+
* @returns The envelope: the output, with what could not be read on the error channel.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* await filter_run('wc', ['notes.txt'], (sources: FilterSource[]): string => wc_render(ask, sources));
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export declare function filter_run(command: string, files: ReadonlyArray<string>, answer: (sources: FilterSource[]) => string): Promise<CommandEnvelope>;
|
|
142
|
+
/**
|
|
143
|
+
* What `wc` counts.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* const ask: WcAsk = { lines: true, words: false, bytes: false, chars: false };
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
18
150
|
export interface WcAsk {
|
|
151
|
+
/** Newlines. */
|
|
19
152
|
lines: boolean;
|
|
153
|
+
/** Words between blanks. */
|
|
20
154
|
words: boolean;
|
|
155
|
+
/** Bytes. */
|
|
21
156
|
bytes: boolean;
|
|
157
|
+
/** Characters. */
|
|
22
158
|
chars: boolean;
|
|
23
159
|
}
|
|
24
|
-
/**
|
|
160
|
+
/**
|
|
161
|
+
* One source's counts.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* const counts: WcCounts = wc_count('a b\n');
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
25
168
|
export interface WcCounts {
|
|
169
|
+
/** Newlines. */
|
|
26
170
|
lines: number;
|
|
171
|
+
/** Words between blanks. */
|
|
27
172
|
words: number;
|
|
173
|
+
/** Bytes, in UTF-8. */
|
|
28
174
|
bytes: number;
|
|
175
|
+
/** Characters. */
|
|
29
176
|
chars: number;
|
|
30
177
|
}
|
|
31
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* Counts a text as `wc` does: newlines, words between blanks, bytes, characters.
|
|
180
|
+
*
|
|
181
|
+
* @param text - The text.
|
|
182
|
+
* @returns Its counts.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* wc_count('héllo\n'); // { lines: 1, words: 1, bytes: 7, chars: 6 }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
32
189
|
export declare function wc_count(text: string): WcCounts;
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
190
|
+
/**
|
|
191
|
+
* `wc`'s answer: a row per source (and a total for more than one), counts in POSIX order.
|
|
192
|
+
*
|
|
193
|
+
* @param ask - What to count.
|
|
194
|
+
* @param sources - The sources.
|
|
195
|
+
* @returns The rows.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* wc_render({ lines: true, words: false, bytes: false, chars: false }, [{ name: null, text: 'a\n' }]); // '1\n'
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
36
202
|
export declare function wc_render(ask: WcAsk, sources: ReadonlyArray<FilterSource>): string;
|
|
37
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* `wc [-lwcm] [FILE]...`: the declaration.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```ts
|
|
208
|
+
* commands_register({ declarations: [wcCommand] });
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
export declare const wcCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
212
|
+
readonly operands: readonly [{
|
|
213
|
+
readonly name: "files";
|
|
214
|
+
readonly kind: "cfsPath";
|
|
215
|
+
readonly optional: true;
|
|
216
|
+
readonly repeat: true;
|
|
217
|
+
readonly glob: true;
|
|
218
|
+
readonly summary: "ChRIS files to read, in order (a wildcard matches paths; - is the pipe); the pipe when none is named";
|
|
219
|
+
}];
|
|
220
|
+
readonly options: {
|
|
221
|
+
readonly lines: {
|
|
222
|
+
readonly short: "l";
|
|
223
|
+
readonly long: "lines";
|
|
224
|
+
readonly summary: "Count lines";
|
|
225
|
+
};
|
|
226
|
+
readonly words: {
|
|
227
|
+
readonly short: "w";
|
|
228
|
+
readonly long: "words";
|
|
229
|
+
readonly summary: "Count words";
|
|
230
|
+
};
|
|
231
|
+
readonly bytes: {
|
|
232
|
+
readonly short: "c";
|
|
233
|
+
readonly long: "bytes";
|
|
234
|
+
readonly summary: "Count bytes";
|
|
235
|
+
};
|
|
236
|
+
readonly chars: {
|
|
237
|
+
readonly short: "m";
|
|
238
|
+
readonly long: "chars";
|
|
239
|
+
readonly summary: "Count characters";
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* `wc` over words already split: the declaration's parse and handler.
|
|
245
|
+
*
|
|
246
|
+
* @param args - The words after `wc`.
|
|
247
|
+
* @returns The counts, or the refusal of a bad line.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* await builtin_wc(['-l', 'notes.txt']);
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
38
254
|
export declare function builtin_wc(args: string[]): Promise<CommandEnvelope>;
|
|
39
|
-
/**
|
|
255
|
+
/**
|
|
256
|
+
* How much `head` or `tail` keeps: the first or last N lines (or bytes), all
|
|
257
|
+
* but the last N, or from line (or byte) N on.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* const ask: EndsAsk = { count: 5, butLast: false, fromLine: false, bytes: false };
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
40
264
|
export interface EndsAsk {
|
|
265
|
+
/** N. */
|
|
41
266
|
count: number;
|
|
267
|
+
/** head -n -N (or -c -N): all but the last N. */
|
|
42
268
|
butLast: boolean;
|
|
269
|
+
/** tail -n +N (or -c +N): from line (or byte) N on. */
|
|
43
270
|
fromLine: boolean;
|
|
271
|
+
/** -c: N counts bytes, not lines. */
|
|
272
|
+
bytes: boolean;
|
|
44
273
|
}
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
274
|
+
/**
|
|
275
|
+
* The lines `head` keeps of a text.
|
|
276
|
+
*
|
|
277
|
+
* @param ask - How many.
|
|
278
|
+
* @param text - The text.
|
|
279
|
+
* @returns The kept lines.
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* head_lines({ count: 1, butLast: false, fromLine: false, bytes: false }, 'a\nb\n'); // ['a']
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
48
286
|
export declare function head_lines(ask: EndsAsk, text: string): string[];
|
|
49
|
-
/**
|
|
287
|
+
/**
|
|
288
|
+
* The lines `tail` keeps of a text.
|
|
289
|
+
*
|
|
290
|
+
* @param ask - How many.
|
|
291
|
+
* @param text - The text.
|
|
292
|
+
* @returns The kept lines.
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```ts
|
|
296
|
+
* tail_lines({ count: 1, butLast: false, fromLine: false, bytes: false }, 'a\nb\n'); // ['b']
|
|
297
|
+
* ```
|
|
298
|
+
*/
|
|
50
299
|
export declare function tail_lines(ask: EndsAsk, text: string): string[];
|
|
51
|
-
/**
|
|
300
|
+
/**
|
|
301
|
+
* The bytes `head -c` keeps of a text, as text.
|
|
302
|
+
*
|
|
303
|
+
* @param ask - How many.
|
|
304
|
+
* @param text - The text.
|
|
305
|
+
* @returns The kept bytes.
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```ts
|
|
309
|
+
* head_bytes({ count: 3, butLast: false, fromLine: false, bytes: true }, 'hello\n'); // 'hel'
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
export declare function head_bytes(ask: EndsAsk, text: string): string;
|
|
313
|
+
/**
|
|
314
|
+
* The bytes `tail -c` keeps of a text, as text.
|
|
315
|
+
*
|
|
316
|
+
* @param ask - How many.
|
|
317
|
+
* @param text - The text.
|
|
318
|
+
* @returns The kept bytes.
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```ts
|
|
322
|
+
* tail_bytes({ count: 3, butLast: false, fromLine: false, bytes: true }, 'hello\n'); // 'lo\n'
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
export declare function tail_bytes(ask: EndsAsk, text: string): string;
|
|
326
|
+
/**
|
|
327
|
+
* `head [-n N | -N | -c N] [FILE]...`: the declaration.
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```ts
|
|
331
|
+
* commands_register({ declarations: [headCommand] });
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
export declare const headCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
335
|
+
readonly operands: readonly [{
|
|
336
|
+
readonly name: "files";
|
|
337
|
+
readonly kind: "cfsPath";
|
|
338
|
+
readonly optional: true;
|
|
339
|
+
readonly repeat: true;
|
|
340
|
+
readonly glob: true;
|
|
341
|
+
readonly summary: "ChRIS files to read, in order (a wildcard matches paths; - is the pipe); the pipe when none is named";
|
|
342
|
+
}];
|
|
343
|
+
readonly options: {
|
|
344
|
+
readonly lines: {
|
|
345
|
+
readonly short: "n";
|
|
346
|
+
readonly long: "lines";
|
|
347
|
+
readonly numeral: true;
|
|
348
|
+
readonly value: {
|
|
349
|
+
readonly name: "count";
|
|
350
|
+
readonly kind: "word";
|
|
351
|
+
};
|
|
352
|
+
readonly summary: "The first N lines (-N says the same); -n -N: all but the last N";
|
|
353
|
+
};
|
|
354
|
+
readonly bytes: {
|
|
355
|
+
readonly short: "c";
|
|
356
|
+
readonly long: "bytes";
|
|
357
|
+
readonly value: {
|
|
358
|
+
readonly name: "count";
|
|
359
|
+
readonly kind: "word";
|
|
360
|
+
};
|
|
361
|
+
readonly summary: "The first N bytes; -c -N: all but the last N";
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
}>;
|
|
365
|
+
/**
|
|
366
|
+
* `tail [-n N | -N | -n +N | -c N] [-f] [FILE]...`: the declaration.
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* commands_register({ declarations: [tailCommand] });
|
|
371
|
+
* ```
|
|
372
|
+
*/
|
|
373
|
+
export declare const tailCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
374
|
+
readonly operands: readonly [{
|
|
375
|
+
readonly name: "files";
|
|
376
|
+
readonly kind: "cfsPath";
|
|
377
|
+
readonly optional: true;
|
|
378
|
+
readonly repeat: true;
|
|
379
|
+
readonly glob: true;
|
|
380
|
+
readonly summary: "ChRIS files to read, in order (a wildcard matches paths; - is the pipe); the pipe when none is named";
|
|
381
|
+
}];
|
|
382
|
+
readonly options: {
|
|
383
|
+
readonly lines: {
|
|
384
|
+
readonly short: "n";
|
|
385
|
+
readonly long: "lines";
|
|
386
|
+
readonly numeral: true;
|
|
387
|
+
readonly value: {
|
|
388
|
+
readonly name: "count";
|
|
389
|
+
readonly kind: "word";
|
|
390
|
+
};
|
|
391
|
+
readonly summary: "The last N lines (-N says the same); -n +N: from line N to the end";
|
|
392
|
+
};
|
|
393
|
+
readonly bytes: {
|
|
394
|
+
readonly short: "c";
|
|
395
|
+
readonly long: "bytes";
|
|
396
|
+
readonly value: {
|
|
397
|
+
readonly name: "count";
|
|
398
|
+
readonly kind: "word";
|
|
399
|
+
};
|
|
400
|
+
readonly summary: "The last N bytes; -c +N: from byte N to the end";
|
|
401
|
+
};
|
|
402
|
+
readonly follow: {
|
|
403
|
+
readonly short: "f";
|
|
404
|
+
readonly long: "follow";
|
|
405
|
+
readonly summary: "Taken: the text is read once and its last lines shown; a ChRIS file or a pipe is not followed";
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
}>;
|
|
409
|
+
/**
|
|
410
|
+
* `head` over words already split: the declaration's parse and handler.
|
|
411
|
+
*
|
|
412
|
+
* @param args - The words after `head`.
|
|
413
|
+
* @returns The lines, or the refusal of a bad line.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* await builtin_head(['-5', 'notes.txt']);
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
52
420
|
export declare function builtin_head(args: string[]): Promise<CommandEnvelope>;
|
|
53
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* `tail` over words already split: the declaration's parse and handler.
|
|
423
|
+
*
|
|
424
|
+
* @param args - The words after `tail`.
|
|
425
|
+
* @returns The lines, or the refusal of a bad line.
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* ```ts
|
|
429
|
+
* await builtin_tail(['-n', '+2', 'a.csv']);
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
54
432
|
export declare function builtin_tail(args: string[]): Promise<CommandEnvelope>;
|
|
55
|
-
/**
|
|
433
|
+
/**
|
|
434
|
+
* How `sort` orders.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```ts
|
|
438
|
+
* const ask: SortAsk = { reverse: false, compare: 'numeric', fold: false, unique: false, key: { from: 2, to: null }, separator: ',' };
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
56
441
|
export interface SortAsk {
|
|
442
|
+
/** Reverse the order. */
|
|
57
443
|
reverse: boolean;
|
|
58
|
-
|
|
444
|
+
/** How two keys compare: as text, by number (-n), by human size (-h, 2K < 1M), or by version (-V, digit runs as numbers). */
|
|
445
|
+
compare: 'text' | 'numeric' | 'human' | 'version';
|
|
446
|
+
/** Ignore case. */
|
|
59
447
|
fold: boolean;
|
|
448
|
+
/** One of each equal line. */
|
|
60
449
|
unique: boolean;
|
|
61
450
|
/** The key's fields, 1-based, inclusive; null for the whole line. */
|
|
62
451
|
key: {
|
|
@@ -66,26 +455,189 @@ export interface SortAsk {
|
|
|
66
455
|
/** The field separator; null for runs of blanks. */
|
|
67
456
|
separator: string | null;
|
|
68
457
|
}
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
458
|
+
/**
|
|
459
|
+
* The lines in `sort`'s order: stable, by key, as text, number, size or version, then reversed, then unique by key.
|
|
460
|
+
*
|
|
461
|
+
* @param ask - How it orders.
|
|
462
|
+
* @param lines - The lines.
|
|
463
|
+
* @returns The lines in order.
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* ```ts
|
|
467
|
+
* sort_lines({ reverse: false, compare: 'human', fold: false, unique: false, key: null, separator: null }, ['1M', '2K']); // ['2K', '1M']
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
72
470
|
export declare function sort_lines(ask: SortAsk, lines: ReadonlyArray<string>): string[];
|
|
73
|
-
/**
|
|
471
|
+
/**
|
|
472
|
+
* `sort [-rnhVfu] [-k N[,M]] [-t C] [FILE]...`: the declaration.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```ts
|
|
476
|
+
* commands_register({ declarations: [sortCommand] });
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
export declare const sortCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
480
|
+
readonly operands: readonly [{
|
|
481
|
+
readonly name: "files";
|
|
482
|
+
readonly kind: "cfsPath";
|
|
483
|
+
readonly optional: true;
|
|
484
|
+
readonly repeat: true;
|
|
485
|
+
readonly glob: true;
|
|
486
|
+
readonly summary: "ChRIS files to read, in order (a wildcard matches paths; - is the pipe); the pipe when none is named";
|
|
487
|
+
}];
|
|
488
|
+
readonly options: {
|
|
489
|
+
readonly reverse: {
|
|
490
|
+
readonly short: "r";
|
|
491
|
+
readonly long: "reverse";
|
|
492
|
+
readonly summary: "Reverse the order";
|
|
493
|
+
};
|
|
494
|
+
readonly numeric: {
|
|
495
|
+
readonly short: "n";
|
|
496
|
+
readonly long: "numeric-sort";
|
|
497
|
+
readonly summary: "Compare by number";
|
|
498
|
+
};
|
|
499
|
+
readonly human: {
|
|
500
|
+
readonly short: "h";
|
|
501
|
+
readonly long: "human-numeric-sort";
|
|
502
|
+
readonly summary: "Compare human sizes: 2K < 1M < 3G";
|
|
503
|
+
};
|
|
504
|
+
readonly version: {
|
|
505
|
+
readonly short: "V";
|
|
506
|
+
readonly long: "version-sort";
|
|
507
|
+
readonly summary: "Compare versions: runs of digits as numbers (v2 < v10)";
|
|
508
|
+
};
|
|
509
|
+
readonly fold: {
|
|
510
|
+
readonly short: "f";
|
|
511
|
+
readonly long: "ignore-case";
|
|
512
|
+
readonly summary: "Ignore case";
|
|
513
|
+
};
|
|
514
|
+
readonly unique: {
|
|
515
|
+
readonly short: "u";
|
|
516
|
+
readonly long: "unique";
|
|
517
|
+
readonly summary: "One of each equal line";
|
|
518
|
+
};
|
|
519
|
+
readonly key: {
|
|
520
|
+
readonly short: "k";
|
|
521
|
+
readonly long: "key";
|
|
522
|
+
readonly value: {
|
|
523
|
+
readonly name: "N[,M]";
|
|
524
|
+
readonly kind: "word";
|
|
525
|
+
};
|
|
526
|
+
readonly summary: "Compare fields N to M (to the end without M)";
|
|
527
|
+
};
|
|
528
|
+
readonly separator: {
|
|
529
|
+
readonly short: "t";
|
|
530
|
+
readonly long: "field-separator";
|
|
531
|
+
readonly value: {
|
|
532
|
+
readonly name: "C";
|
|
533
|
+
readonly kind: "word";
|
|
534
|
+
};
|
|
535
|
+
readonly summary: "Fields split at C, not at runs of blanks";
|
|
536
|
+
};
|
|
537
|
+
};
|
|
538
|
+
}>;
|
|
539
|
+
/**
|
|
540
|
+
* `sort` over words already split: the declaration's parse and handler.
|
|
541
|
+
*
|
|
542
|
+
* @param args - The words after `sort`.
|
|
543
|
+
* @returns The lines in order, or the refusal of a bad line.
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* ```ts
|
|
547
|
+
* await builtin_sort(['-t', ',', '-k', '2', 'a.csv']);
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
74
550
|
export declare function builtin_sort(args: string[]): Promise<CommandEnvelope>;
|
|
75
|
-
/**
|
|
551
|
+
/**
|
|
552
|
+
* What `uniq` keeps of each run of equal lines.
|
|
553
|
+
*
|
|
554
|
+
* @example
|
|
555
|
+
* ```ts
|
|
556
|
+
* const ask: UniqAsk = { count: true, repeated: false, unique: false, fold: false };
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
76
559
|
export interface UniqAsk {
|
|
560
|
+
/** Prefix each with its count. */
|
|
77
561
|
count: boolean;
|
|
562
|
+
/** Only repeated lines. */
|
|
78
563
|
repeated: boolean;
|
|
564
|
+
/** Only lines never repeated. */
|
|
79
565
|
unique: boolean;
|
|
566
|
+
/** Ignore case. */
|
|
80
567
|
fold: boolean;
|
|
81
568
|
}
|
|
82
|
-
/**
|
|
83
|
-
|
|
84
|
-
|
|
569
|
+
/**
|
|
570
|
+
* Adjacent equal lines folded to one, as `uniq` does.
|
|
571
|
+
*
|
|
572
|
+
* @param ask - What it keeps.
|
|
573
|
+
* @param lines - The lines.
|
|
574
|
+
* @returns The kept lines.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* ```ts
|
|
578
|
+
* uniq_lines({ count: false, repeated: false, unique: false, fold: false }, ['a', 'a', 'b']); // ['a', 'b']
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
85
581
|
export declare function uniq_lines(ask: UniqAsk, lines: ReadonlyArray<string>): string[];
|
|
86
|
-
/**
|
|
582
|
+
/**
|
|
583
|
+
* `uniq [-cdui] [FILE]`: the declaration.
|
|
584
|
+
*
|
|
585
|
+
* @example
|
|
586
|
+
* ```ts
|
|
587
|
+
* commands_register({ declarations: [uniqCommand] });
|
|
588
|
+
* ```
|
|
589
|
+
*/
|
|
590
|
+
export declare const uniqCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
591
|
+
readonly operands: readonly [{
|
|
592
|
+
readonly name: "file";
|
|
593
|
+
readonly kind: "cfsPath";
|
|
594
|
+
readonly optional: true;
|
|
595
|
+
readonly glob: true;
|
|
596
|
+
readonly summary: "A ChRIS file to read (- is the pipe); the pipe when none is named";
|
|
597
|
+
}];
|
|
598
|
+
readonly options: {
|
|
599
|
+
readonly count: {
|
|
600
|
+
readonly short: "c";
|
|
601
|
+
readonly long: "count";
|
|
602
|
+
readonly summary: "Prefix each with its count";
|
|
603
|
+
};
|
|
604
|
+
readonly repeated: {
|
|
605
|
+
readonly short: "d";
|
|
606
|
+
readonly long: "repeated";
|
|
607
|
+
readonly summary: "Only repeated lines";
|
|
608
|
+
};
|
|
609
|
+
readonly unique: {
|
|
610
|
+
readonly short: "u";
|
|
611
|
+
readonly long: "unique";
|
|
612
|
+
readonly summary: "Only lines never repeated";
|
|
613
|
+
};
|
|
614
|
+
readonly fold: {
|
|
615
|
+
readonly short: "i";
|
|
616
|
+
readonly long: "ignore-case";
|
|
617
|
+
readonly summary: "Ignore case";
|
|
618
|
+
};
|
|
619
|
+
};
|
|
620
|
+
}>;
|
|
621
|
+
/**
|
|
622
|
+
* `uniq` over words already split: the declaration's parse and handler.
|
|
623
|
+
*
|
|
624
|
+
* @param args - The words after `uniq`.
|
|
625
|
+
* @returns The folded lines, or the refusal of a bad line.
|
|
626
|
+
*
|
|
627
|
+
* @example
|
|
628
|
+
* ```ts
|
|
629
|
+
* await builtin_uniq(['-c']);
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
87
632
|
export declare function builtin_uniq(args: string[]): Promise<CommandEnvelope>;
|
|
88
|
-
/**
|
|
633
|
+
/**
|
|
634
|
+
* What `cut` keeps of each line.
|
|
635
|
+
*
|
|
636
|
+
* @example
|
|
637
|
+
* ```ts
|
|
638
|
+
* const ask: CutAsk = { by: 'fields', ranges: [{ from: 1, to: 1 }], delimiter: ',', onlyDelimited: false };
|
|
639
|
+
* ```
|
|
640
|
+
*/
|
|
89
641
|
export interface CutAsk {
|
|
90
642
|
/** Fields or characters. */
|
|
91
643
|
by: 'fields' | 'chars';
|
|
@@ -94,14 +646,94 @@ export interface CutAsk {
|
|
|
94
646
|
from: number;
|
|
95
647
|
to: number | null;
|
|
96
648
|
}>;
|
|
649
|
+
/** The field delimiter. */
|
|
97
650
|
delimiter: string;
|
|
98
651
|
/** With fields: drop a line that holds no delimiter. */
|
|
99
652
|
onlyDelimited: boolean;
|
|
100
653
|
}
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
654
|
+
/**
|
|
655
|
+
* What `cut` keeps of each line.
|
|
656
|
+
*
|
|
657
|
+
* @param ask - What it keeps.
|
|
658
|
+
* @param lines - The lines.
|
|
659
|
+
* @returns The kept parts, a line each (a line with no delimiter dropped under -s).
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* ```ts
|
|
663
|
+
* cut_lines({ by: 'fields', ranges: [{ from: 2, to: 2 }], delimiter: ',', onlyDelimited: false }, ['a,b']); // ['b']
|
|
664
|
+
* ```
|
|
665
|
+
*/
|
|
104
666
|
export declare function cut_lines(ask: CutAsk, lines: ReadonlyArray<string>): string[];
|
|
105
|
-
/**
|
|
667
|
+
/**
|
|
668
|
+
* `cut -f LIST [-d C] [-s] | -c LIST [FILE]...`: the declaration.
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* ```ts
|
|
672
|
+
* commands_register({ declarations: [cutCommand] });
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
export declare const cutCommand: import("../../core/commandDeclaration.js").CommandDeclaration<{
|
|
676
|
+
readonly operands: readonly [{
|
|
677
|
+
readonly name: "files";
|
|
678
|
+
readonly kind: "cfsPath";
|
|
679
|
+
readonly optional: true;
|
|
680
|
+
readonly repeat: true;
|
|
681
|
+
readonly glob: true;
|
|
682
|
+
readonly summary: "ChRIS files to read, in order (a wildcard matches paths; - is the pipe); the pipe when none is named";
|
|
683
|
+
}];
|
|
684
|
+
readonly options: {
|
|
685
|
+
readonly fields: {
|
|
686
|
+
readonly short: "f";
|
|
687
|
+
readonly long: "fields";
|
|
688
|
+
readonly value: {
|
|
689
|
+
readonly name: "LIST";
|
|
690
|
+
readonly kind: "word";
|
|
691
|
+
};
|
|
692
|
+
readonly summary: "Keep these fields";
|
|
693
|
+
};
|
|
694
|
+
readonly chars: {
|
|
695
|
+
readonly short: "c";
|
|
696
|
+
readonly long: "characters";
|
|
697
|
+
readonly value: {
|
|
698
|
+
readonly name: "LIST";
|
|
699
|
+
readonly kind: "word";
|
|
700
|
+
};
|
|
701
|
+
readonly summary: "Keep these characters";
|
|
702
|
+
};
|
|
703
|
+
readonly bytes: {
|
|
704
|
+
readonly short: "b";
|
|
705
|
+
readonly long: "bytes";
|
|
706
|
+
readonly value: {
|
|
707
|
+
readonly name: "LIST";
|
|
708
|
+
readonly kind: "word";
|
|
709
|
+
};
|
|
710
|
+
readonly summary: "Keep these characters (as -c)";
|
|
711
|
+
};
|
|
712
|
+
readonly delimiter: {
|
|
713
|
+
readonly short: "d";
|
|
714
|
+
readonly long: "delimiter";
|
|
715
|
+
readonly value: {
|
|
716
|
+
readonly name: "C";
|
|
717
|
+
readonly kind: "word";
|
|
718
|
+
};
|
|
719
|
+
readonly summary: "The field delimiter (a tab when not said)";
|
|
720
|
+
};
|
|
721
|
+
readonly onlyDelimited: {
|
|
722
|
+
readonly short: "s";
|
|
723
|
+
readonly long: "only-delimited";
|
|
724
|
+
readonly summary: "Only lines that hold the delimiter";
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
}>;
|
|
728
|
+
/**
|
|
729
|
+
* `cut` over words already split: the declaration's parse and handler.
|
|
730
|
+
*
|
|
731
|
+
* @param args - The words after `cut`.
|
|
732
|
+
* @returns The kept parts, or the refusal of a bad line.
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* ```ts
|
|
736
|
+
* await builtin_cut(['-d', ',', '-f', '1', 'a.csv']);
|
|
737
|
+
* ```
|
|
738
|
+
*/
|
|
106
739
|
export declare function builtin_cut(args: string[]): Promise<CommandEnvelope>;
|
|
107
|
-
export {};
|