@fnndsc/brasa 0.56.3 → 0.57.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/buildinfo.json +1 -1
- package/dist/builtins/argumentTokens.d.ts +13 -0
- package/dist/builtins/argumentTokens.js +15 -3
- package/dist/builtins/argumentTokens.js.map +1 -1
- package/dist/builtins/berth/berth.d.ts +11 -0
- package/dist/builtins/berth/berth.js +53 -22
- package/dist/builtins/berth/berth.js.map +1 -1
- package/dist/builtins/berth/berthCube.d.ts +14 -0
- package/dist/builtins/berth/berthCube.js +17 -0
- package/dist/builtins/berth/berthCube.js.map +1 -1
- package/dist/builtins/fs/download.d.ts +12 -1
- package/dist/builtins/fs/download.js +24 -4
- package/dist/builtins/fs/download.js.map +1 -1
- package/dist/builtins/fs/transferJobs.d.ts +64 -0
- package/dist/builtins/fs/transferJobs.js +98 -0
- package/dist/builtins/fs/transferJobs.js.map +1 -0
- package/dist/builtins/fs/upload.d.ts +14 -1
- package/dist/builtins/fs/upload.js +22 -5
- package/dist/builtins/fs/upload.js.map +1 -1
- package/dist/builtins/fs/url.d.ts +27 -2
- package/dist/builtins/fs/url.js +60 -10
- package/dist/builtins/fs/url.js.map +1 -1
- package/dist/builtins/help.d.ts +6 -10
- package/dist/builtins/help.js +34 -87
- package/dist/builtins/help.js.map +1 -1
- package/dist/builtins/helpSections.js +4 -1
- package/dist/builtins/helpSections.js.map +1 -1
- package/dist/builtins/pluginExecute.d.ts +21 -3
- package/dist/builtins/pluginExecute.js +69 -33
- package/dist/builtins/pluginExecute.js.map +1 -1
- package/dist/builtins/res/pipeline.d.ts +231 -2
- package/dist/builtins/res/pipeline.js +225 -107
- package/dist/builtins/res/pipeline.js.map +1 -1
- package/dist/builtins/res/plugin.d.ts +343 -3
- package/dist/builtins/res/plugin.js +221 -67
- package/dist/builtins/res/plugin.js.map +1 -1
- package/dist/builtins/res/plugin.sync.js +5 -3
- package/dist/builtins/res/plugin.sync.js.map +1 -1
- package/dist/chris/binDeclarations.d.ts +312 -0
- package/dist/chris/binDeclarations.js +572 -0
- package/dist/chris/binDeclarations.js.map +1 -0
- package/dist/chris/chrisCommands.d.ts +1 -0
- package/dist/chris/chrisCommands.js +5 -30
- package/dist/chris/chrisCommands.js.map +1 -1
- package/dist/chris/commandFallback.d.ts +30 -3
- package/dist/chris/commandFallback.js +163 -94
- package/dist/chris/commandFallback.js.map +1 -1
- package/dist/chris/completion.d.ts +37 -0
- package/dist/chris/completion.js +41 -121
- package/dist/chris/completion.js.map +1 -1
- package/dist/chris/kinds.d.ts +11 -0
- package/dist/chris/kinds.js +32 -1
- package/dist/chris/kinds.js.map +1 -1
- package/dist/core/argumentKinds.d.ts +18 -0
- package/dist/core/argumentKinds.js +33 -0
- package/dist/core/argumentKinds.js.map +1 -1
- package/dist/core/backend.d.ts +12 -5
- package/dist/core/backend.js.map +1 -1
- package/dist/core/commandDeclaration.d.ts +40 -0
- package/dist/core/commandDeclaration.js.map +1 -1
- package/dist/core/commandOrder.js +3 -3
- package/dist/core/commandOrder.js.map +1 -1
- package/dist/core/commandParse.d.ts +14 -0
- package/dist/core/commandParse.js +39 -5
- package/dist/core/commandParse.js.map +1 -1
- package/dist/core/commandRegistry.d.ts +22 -36
- package/dist/core/commandRegistry.js +19 -10
- package/dist/core/commandRegistry.js.map +1 -1
- package/dist/core/commandSchema.js +4 -0
- package/dist/core/commandSchema.js.map +1 -1
- package/dist/core/coreCommands.d.ts +1 -0
- package/dist/core/coreCommands.js +6 -19
- package/dist/core/coreCommands.js.map +1 -1
- package/dist/core/dispatch.js +12 -41
- package/dist/core/dispatch.js.map +1 -1
- package/dist/core/preprocess.d.ts +0 -15
- package/dist/core/preprocess.js +0 -17
- package/dist/core/preprocess.js.map +1 -1
- package/dist/core/shellWords.d.ts +34 -0
- package/dist/core/shellWords.js +60 -0
- package/dist/core/shellWords.js.map +1 -0
- package/dist/core.d.ts +5 -0
- package/dist/core.js +4 -0
- package/dist/core.js.map +1 -1
- package/dist/lib/completer/declared.js +22 -6
- package/dist/lib/completer/declared.js.map +1 -1
- package/dist/lib/completer/index.js +15 -53
- package/dist/lib/completer/index.js.map +1 -1
- package/dist/notes.json +1 -1
- package/package.json +5 -5
- package/dist/builtins/res/pipeline.args.d.ts +0 -35
- package/dist/builtins/res/pipeline.args.js +0 -94
- package/dist/builtins/res/pipeline.args.js.map +0 -1
- package/dist/chris/help.d.ts +0 -18
- package/dist/chris/help.js +0 -229
- package/dist/chris/help.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** The session variable that says how many files move at once when a line does not. */
|
|
2
|
+
export declare const TRANSFER_JOBS_VARIABLE: string;
|
|
3
|
+
/**
|
|
4
|
+
* `-j N` / `--jobs N`: how many files move at once.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const GRAMMAR = { options: { jobs: TRANSFER_JOBS_OPTION } } as const satisfies CommandGrammar;
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const TRANSFER_JOBS_OPTION: {
|
|
12
|
+
readonly short: "j";
|
|
13
|
+
readonly long: "jobs";
|
|
14
|
+
readonly summary: `Move N files at once, 1 to ${number} (1 is one at a time); without it $TRANSFER_JOBS, else ${number}`;
|
|
15
|
+
readonly value: {
|
|
16
|
+
readonly name: "N";
|
|
17
|
+
readonly kind: "int";
|
|
18
|
+
readonly min: 1;
|
|
19
|
+
readonly max: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* How many files a transfer moves at once, or why the session's variable
|
|
24
|
+
* cannot say.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const jobs: TransferJobs = { jobs: 8 };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export type TransferJobs = {
|
|
32
|
+
readonly jobs: number;
|
|
33
|
+
} | {
|
|
34
|
+
readonly refused: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The number of files a transfer moves at once: the line's `-j`, else the
|
|
38
|
+
* session's `TRANSFER_JOBS`, else the pool's default.
|
|
39
|
+
*
|
|
40
|
+
* @param given - The line's `-j`, already checked by the parser; undefined when the line gives none.
|
|
41
|
+
* @returns The number, or a plain line refusing the variable's value.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* transferJobs_resolve(4); // { jobs: 4 }
|
|
46
|
+
* transferJobs_resolve(undefined); // { jobs: 8 }, or $TRANSFER_JOBS
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function transferJobs_resolve(given: number | undefined): TransferJobs;
|
|
50
|
+
/**
|
|
51
|
+
* The lines under a transfer's summary that name each file that failed
|
|
52
|
+
* after its retry, and say how many a cancel left.
|
|
53
|
+
*
|
|
54
|
+
* @param failedPaths - The files that failed, as the transfer names them.
|
|
55
|
+
* @param cancelledCount - How many files a cancel left unmoved.
|
|
56
|
+
* @param verb - What the transfer does to a file (`downloaded`, `uploaded`).
|
|
57
|
+
* @returns The lines, each ending in a newline; empty when nothing failed or was left.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* transferLeftovers_render(['/home/me/uploads/a.dcm'], 0, 'downloaded'); // ' failed: /home/me/uploads/a.dcm\n'
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare function transferLeftovers_render(failedPaths: readonly string[], cancelledCount: number, verb: string): string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file How many files a transfer moves at once: the `-j N` / `--jobs N`
|
|
3
|
+
* option `download`, `upload` and `berth anchor` share, and the session
|
|
4
|
+
* variable `TRANSFER_JOBS` that stands in when a line gives none.
|
|
5
|
+
*
|
|
6
|
+
* The option's bounds are the transfer pool's (cumin's
|
|
7
|
+
* `TRANSFER_JOBS_MAX`), so the parser refuses `-j 40` before anything moves,
|
|
8
|
+
* and the variable is checked by the same `int` kind, so the two refuse in
|
|
9
|
+
* the same words.
|
|
10
|
+
*
|
|
11
|
+
* Key components:
|
|
12
|
+
* - TRANSFER_JOBS_OPTION: the option, for a command's grammar.
|
|
13
|
+
* - TRANSFER_JOBS_VARIABLE: the session variable's name.
|
|
14
|
+
* - transferJobs_resolve: the line's number, else the variable's, else the default.
|
|
15
|
+
* - transferLeftovers_render: the lines naming what failed and what a cancel left.
|
|
16
|
+
*
|
|
17
|
+
* Typical usage:
|
|
18
|
+
* ```ts
|
|
19
|
+
* const jobs: TransferJobs = transferJobs_resolve(args.options.jobs);
|
|
20
|
+
* if ('refused' in jobs) return refusal(jobs.refused);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Dependencies: cumin's transfer pool for the bounds; the session's variables.
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/
|
|
27
|
+
import chalk from 'chalk';
|
|
28
|
+
import { TRANSFER_JOBS_DEFAULT, TRANSFER_JOBS_MAX } from '@fnndsc/cumin/transfer-pool';
|
|
29
|
+
import { argumentWord_check } from '../../core/argumentKinds.js';
|
|
30
|
+
import { TEXT_KIND, variable_get } from '../../core/variables.js';
|
|
31
|
+
/** The session variable that says how many files move at once when a line does not. */
|
|
32
|
+
export const TRANSFER_JOBS_VARIABLE = 'TRANSFER_JOBS';
|
|
33
|
+
/**
|
|
34
|
+
* `-j N` / `--jobs N`: how many files move at once.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const GRAMMAR = { options: { jobs: TRANSFER_JOBS_OPTION } } as const satisfies CommandGrammar;
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export const TRANSFER_JOBS_OPTION = {
|
|
42
|
+
short: 'j',
|
|
43
|
+
long: 'jobs',
|
|
44
|
+
summary: `Move N files at once, 1 to ${TRANSFER_JOBS_MAX} (1 is one at a time); without it $TRANSFER_JOBS, else ${TRANSFER_JOBS_DEFAULT}`,
|
|
45
|
+
value: { name: 'N', kind: 'int', min: 1, max: TRANSFER_JOBS_MAX },
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The number of files a transfer moves at once: the line's `-j`, else the
|
|
49
|
+
* session's `TRANSFER_JOBS`, else the pool's default.
|
|
50
|
+
*
|
|
51
|
+
* @param given - The line's `-j`, already checked by the parser; undefined when the line gives none.
|
|
52
|
+
* @returns The number, or a plain line refusing the variable's value.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* transferJobs_resolve(4); // { jobs: 4 }
|
|
57
|
+
* transferJobs_resolve(undefined); // { jobs: 8 }, or $TRANSFER_JOBS
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export function transferJobs_resolve(given) {
|
|
61
|
+
if (given !== undefined)
|
|
62
|
+
return { jobs: given };
|
|
63
|
+
const variable = variable_get(TRANSFER_JOBS_VARIABLE);
|
|
64
|
+
if (variable === undefined)
|
|
65
|
+
return { jobs: TRANSFER_JOBS_DEFAULT };
|
|
66
|
+
const range = `it says how many files move at once, a whole number from 1 to ${TRANSFER_JOBS_MAX}`;
|
|
67
|
+
if (variable.answer.kind !== TEXT_KIND || typeof variable.answer.data !== 'string') {
|
|
68
|
+
return { refused: `${TRANSFER_JOBS_VARIABLE} holds a ${variable.answer.kind}; ${range}` };
|
|
69
|
+
}
|
|
70
|
+
const text = variable.answer.data.trim();
|
|
71
|
+
const checked = argumentWord_check(TRANSFER_JOBS_OPTION.value, text);
|
|
72
|
+
if (!checked.ok)
|
|
73
|
+
return { refused: `${TRANSFER_JOBS_VARIABLE} is ${text === '' ? "''" : text}; ${range}` };
|
|
74
|
+
return { jobs: checked.value };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The lines under a transfer's summary that name each file that failed
|
|
78
|
+
* after its retry, and say how many a cancel left.
|
|
79
|
+
*
|
|
80
|
+
* @param failedPaths - The files that failed, as the transfer names them.
|
|
81
|
+
* @param cancelledCount - How many files a cancel left unmoved.
|
|
82
|
+
* @param verb - What the transfer does to a file (`downloaded`, `uploaded`).
|
|
83
|
+
* @returns The lines, each ending in a newline; empty when nothing failed or was left.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* transferLeftovers_render(['/home/me/uploads/a.dcm'], 0, 'downloaded'); // ' failed: /home/me/uploads/a.dcm\n'
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export function transferLeftovers_render(failedPaths, cancelledCount, verb) {
|
|
91
|
+
let rendered = '';
|
|
92
|
+
for (const failed of failedPaths)
|
|
93
|
+
rendered += `${chalk.red(` failed: ${failed}`)}\n`;
|
|
94
|
+
if (cancelledCount > 0)
|
|
95
|
+
rendered += `${chalk.yellow(` cancelled: ${cancelledCount} file(s) not ${verb}`)}\n`;
|
|
96
|
+
return rendered;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=transferJobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transferJobs.js","sourceRoot":"","sources":["../../../src/builtins/fs/transferJobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEvF,OAAO,EAAE,kBAAkB,EAAsB,MAAM,6BAA6B,CAAC;AAErF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAiB,MAAM,yBAAyB,CAAC;AAEjF,uFAAuF;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAW,eAAe,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,8BAA8B,iBAAiB,0DAA0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AsB,EAAE,IAAY;IAC3G,IAAI,QAAQ,GAAW,EAAE,CAAC;IAC1B,KAAK,MAAM,MAAM,IAAI,WAAW;QAAE,QAAQ,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,aAAa,MAAM,EAAE,CAAC,IAAI,CAAC;IACtF,IAAI,cAAc,GAAG,CAAC;QAAE,QAAQ,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,gBAAgB,cAAc,gBAAgB,IAAI,EAAE,CAAC,IAAI,CAAC;IAC9G,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CommandEnvelope } from '@fnndsc/menu';
|
|
2
2
|
/**
|
|
3
|
-
* `upload <source> <destination>`: the declaration.
|
|
3
|
+
* `upload [-j N] <source> <destination>`: the declaration.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
6
|
* ```ts
|
|
@@ -17,6 +17,19 @@ export declare const uploadCommand: import("../../core/commandDeclaration.js").C
|
|
|
17
17
|
readonly kind: "cfsPath";
|
|
18
18
|
readonly summary: "The ChRIS folder it goes into";
|
|
19
19
|
}];
|
|
20
|
+
readonly options: {
|
|
21
|
+
readonly jobs: {
|
|
22
|
+
readonly short: "j";
|
|
23
|
+
readonly long: "jobs";
|
|
24
|
+
readonly summary: `Move N files at once, 1 to ${number} (1 is one at a time); without it $TRANSFER_JOBS, else ${number}`;
|
|
25
|
+
readonly value: {
|
|
26
|
+
readonly name: "N";
|
|
27
|
+
readonly kind: "int";
|
|
28
|
+
readonly min: 1;
|
|
29
|
+
readonly max: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
20
33
|
}>;
|
|
21
34
|
/**
|
|
22
35
|
* `upload` over words already split: the declaration's parse and handler.
|
|
@@ -34,6 +34,8 @@ import { declaredCommand_run } from '../../core/commandParse.js';
|
|
|
34
34
|
import { errorStack } from '@fnndsc/fond';
|
|
35
35
|
import { envelope_ok, envelope_error } from '@fnndsc/menu';
|
|
36
36
|
import { exitCode_set } from '../../core/handlerRun.js';
|
|
37
|
+
import { commandCancellation_enable, commandCancellation_signalGet } from '../../core/cancellation.js';
|
|
38
|
+
import { TRANSFER_JOBS_OPTION, transferJobs_resolve, transferLeftovers_render } from './transferJobs.js';
|
|
37
39
|
/** The characters that make a host path a pattern chili matches against the disk. */
|
|
38
40
|
const HOST_WILDCARD = /[*?[]/;
|
|
39
41
|
/**
|
|
@@ -56,9 +58,12 @@ const UPLOAD_GRAMMAR = {
|
|
|
56
58
|
{ name: 'source', kind: 'hostPath', summary: "What to upload from this machine's disk: a file, a folder, or a wildcard chili matches there" },
|
|
57
59
|
{ name: 'destination', kind: 'cfsPath', summary: 'The ChRIS folder it goes into' },
|
|
58
60
|
],
|
|
61
|
+
options: {
|
|
62
|
+
jobs: TRANSFER_JOBS_OPTION,
|
|
63
|
+
},
|
|
59
64
|
};
|
|
60
65
|
/**
|
|
61
|
-
* `upload <source> <destination>`: the declaration.
|
|
66
|
+
* `upload [-j N] <source> <destination>`: the declaration.
|
|
62
67
|
*
|
|
63
68
|
* @example
|
|
64
69
|
* ```ts
|
|
@@ -70,16 +75,17 @@ export const uploadCommand = command_declare({
|
|
|
70
75
|
grammar: UPLOAD_GRAMMAR,
|
|
71
76
|
help: {
|
|
72
77
|
summary: 'Upload local files, directories, or glob matches to ChRIS',
|
|
73
|
-
description: 'Upload local files, directories, or glob matches to ChRIS with progress tracking. A progress bar shows the file count and percentage complete, the estimated time remaining (ETA) and the data transferred; summary statistics follow the upload.',
|
|
78
|
+
description: 'Upload local files, directories, or glob matches to ChRIS with progress tracking. A progress bar shows the file count and percentage complete, the estimated time remaining (ETA) and the data transferred; summary statistics follow the upload. The files of a folder move 8 at a time (-j N, or the session variable TRANSFER_JOBS, says how many, 1 to 32); a file that fails is tried once more, the rest continue, and the summary names each that failed.',
|
|
74
79
|
category: 'Files',
|
|
75
80
|
examples: [
|
|
76
81
|
'upload ~/data/file.csv /home/user/uploads/',
|
|
77
82
|
'upload ~/Pictures/earthandmoon* .',
|
|
78
83
|
'upload ./results/ ~/data/',
|
|
79
84
|
'upload ~/experiment/data /home/user/projects/',
|
|
85
|
+
'upload -j 1 ./results/ ~/data/ # one at a time',
|
|
80
86
|
],
|
|
81
87
|
},
|
|
82
|
-
handler: async (args) => upload_run(args.operands.source, args.operands.destination),
|
|
88
|
+
handler: async (args) => upload_run(args.operands.source, args.operands.destination, args.options.jobs),
|
|
83
89
|
});
|
|
84
90
|
/**
|
|
85
91
|
* `upload` over words already split: the declaration's parse and handler.
|
|
@@ -95,9 +101,10 @@ export async function builtin_upload(args) {
|
|
|
95
101
|
*
|
|
96
102
|
* @param localPath - The host path, as typed: a wildcard in it is matched on the engine's disk.
|
|
97
103
|
* @param remotePath - The ChRIS destination, as typed.
|
|
104
|
+
* @param jobsGiven - The line's `-j`; undefined when it gives none.
|
|
98
105
|
* @returns An envelope carrying the upload summary.
|
|
99
106
|
*/
|
|
100
|
-
async function upload_run(localPath, remotePath) {
|
|
107
|
+
async function upload_run(localPath, remotePath, jobsGiven) {
|
|
101
108
|
// The local path is read by the ENGINE: under a daemon that is the daemon
|
|
102
109
|
// host's disk, which belongs to nobody attending the session unless the
|
|
103
110
|
// operator declared it theirs (--host-control=files). Without that, refuse
|
|
@@ -106,6 +113,13 @@ async function upload_run(localPath, remotePath) {
|
|
|
106
113
|
exitCode_set(1);
|
|
107
114
|
return envelope_error('', undefined, `${chalk.red("upload: calypso's host disk is nobody's; start calypso with --host-control=files, or upload from a surface that can supply the bytes.")}\n`);
|
|
108
115
|
}
|
|
116
|
+
const jobs = transferJobs_resolve(jobsGiven);
|
|
117
|
+
if ('refused' in jobs) {
|
|
118
|
+
exitCode_set(1);
|
|
119
|
+
return envelope_error('', undefined, `${chalk.red(`upload: ${jobs.refused}`)}\n`);
|
|
120
|
+
}
|
|
121
|
+
commandCancellation_enable();
|
|
122
|
+
const signal = commandCancellation_signalGet();
|
|
109
123
|
// chili reads an exact path first and matches a pattern only when nothing
|
|
110
124
|
// stands at it.
|
|
111
125
|
const localGlob = HOST_WILDCARD.test(localPath);
|
|
@@ -114,6 +128,8 @@ async function upload_run(localPath, remotePath) {
|
|
|
114
128
|
try {
|
|
115
129
|
const summary = await chefs_upload_cmd(localPath, targetRemote, {
|
|
116
130
|
expandLocalGlob: localGlob,
|
|
131
|
+
jobs: jobs.jobs,
|
|
132
|
+
...(signal !== undefined ? { signal } : {}),
|
|
117
133
|
confirm: uploadConfirmation_request,
|
|
118
134
|
onNotice: (message, channel) => {
|
|
119
135
|
const sink = sink_get();
|
|
@@ -132,6 +148,7 @@ async function upload_run(localPath, remotePath) {
|
|
|
132
148
|
rendered += `${chalk.yellow(`⚠ Uploaded ${summary.transferredCount} file(s), ${summary.failedCount} failed`)}\n`;
|
|
133
149
|
}
|
|
134
150
|
rendered += `${chalk.gray(` Total: ${bytes_format(summary.transferSize)} in ${summary.duration.toFixed(1)}s (${bytes_format(summary.speed)}/s)`)}\n`;
|
|
151
|
+
rendered += transferLeftovers_render(summary.failedPaths, summary.cancelledCount, 'uploaded');
|
|
135
152
|
// A file that landed under another name because its own was taken must
|
|
136
153
|
// say so: the store has no overwrite, and an upload reported as plain
|
|
137
154
|
// success leaves the operator believing they replaced something.
|
|
@@ -152,7 +169,7 @@ async function upload_run(localPath, remotePath) {
|
|
|
152
169
|
listCache.cache_invalidate(targetRemote);
|
|
153
170
|
listCache.cache_invalidate(await path_resolve(remotePath));
|
|
154
171
|
}
|
|
155
|
-
if (summary.failedCount > 0) {
|
|
172
|
+
if (summary.failedCount > 0 || summary.cancelledCount > 0) {
|
|
156
173
|
exitCode_set(1);
|
|
157
174
|
return envelope_error(rendered, undefined, '');
|
|
158
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/builtins/fs/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,MAAM,OAAO,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AAC,iBAAiB,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CommandEnvelope } from '@fnndsc/menu';
|
|
2
|
+
import { type CommandDeclaration } from '../../core/commandDeclaration.js';
|
|
2
3
|
/** The environment variable naming the door (porter) a link opens through. */
|
|
3
4
|
export declare const URL_DOOR_ENV: string;
|
|
4
5
|
/**
|
|
@@ -9,11 +10,35 @@ export declare const URL_DOOR_ENV: string;
|
|
|
9
10
|
* @returns The link, or the bare fragment when there is no door.
|
|
10
11
|
*/
|
|
11
12
|
export declare function url_compose(door: string, absolutePath: string): string;
|
|
13
|
+
/** What a `url` line may hold. */
|
|
14
|
+
declare const URL_GRAMMAR: {
|
|
15
|
+
readonly operands: readonly [{
|
|
16
|
+
readonly name: "path";
|
|
17
|
+
readonly kind: "cfsPath";
|
|
18
|
+
readonly optional: true;
|
|
19
|
+
readonly summary: "Where the link opens: a feed or a node lands in RUNS, anything else in FILES (default: where you stand)";
|
|
20
|
+
}];
|
|
21
|
+
};
|
|
12
22
|
/**
|
|
13
|
-
*
|
|
23
|
+
* `url [path]`: the declaration, its door read from the process's environment.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* commands_register({ declarations: [urlCommand] });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const urlCommand: CommandDeclaration<typeof URL_GRAMMAR>;
|
|
31
|
+
/**
|
|
32
|
+
* `url` over words already split.
|
|
14
33
|
*
|
|
15
34
|
* @param args - The path, optionally.
|
|
16
35
|
* @param env - The environment the door is read from.
|
|
17
|
-
* @returns An envelope carrying the link and its `fs.url` model.
|
|
36
|
+
* @returns An envelope carrying the link and its `fs.url` model, or the refusal of a bad line.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* await builtin_url(['.']);
|
|
41
|
+
* ```
|
|
18
42
|
*/
|
|
19
43
|
export declare function builtin_url(args?: string[], env?: NodeJS.ProcessEnv): Promise<CommandEnvelope>;
|
|
44
|
+
export {};
|
package/dist/builtins/fs/url.js
CHANGED
|
@@ -8,13 +8,16 @@
|
|
|
8
8
|
* in FILES. The path is the session's resolved absolute path, so the link
|
|
9
9
|
* names the same place for anyone the feed is shared with.
|
|
10
10
|
*
|
|
11
|
+
* Declared in one record (`urlCommand`).
|
|
12
|
+
*
|
|
11
13
|
* @module
|
|
12
14
|
*/
|
|
13
15
|
import chalk from 'chalk';
|
|
14
|
-
import {
|
|
16
|
+
import { envelope_ok } from '@fnndsc/menu';
|
|
15
17
|
import { session } from '../../session/index.js';
|
|
16
18
|
import { path_resolve } from '../utils.js';
|
|
17
|
-
import {
|
|
19
|
+
import { command_declare } from '../../core/commandDeclaration.js';
|
|
20
|
+
import { declaredCommand_run } from '../../core/commandParse.js';
|
|
18
21
|
/** The environment variable naming the door (porter) a link opens through. */
|
|
19
22
|
export const URL_DOOR_ENV = 'CHELL_DOOR';
|
|
20
23
|
/**
|
|
@@ -30,20 +33,19 @@ export function url_compose(door, absolutePath) {
|
|
|
30
33
|
return fragment;
|
|
31
34
|
return `${door.replace(/\/+$/, '')}/${fragment}`;
|
|
32
35
|
}
|
|
36
|
+
/** What a `url` line may hold. */
|
|
37
|
+
const URL_GRAMMAR = {
|
|
38
|
+
operands: [{ name: 'path', kind: 'cfsPath', optional: true, summary: 'Where the link opens: a feed or a node lands in RUNS, anything else in FILES (default: where you stand)' }],
|
|
39
|
+
};
|
|
33
40
|
/**
|
|
34
41
|
* Prints a web address that opens ARGUS at a path (the cwd when none).
|
|
35
42
|
*
|
|
36
|
-
* @param
|
|
43
|
+
* @param path - The path, if given.
|
|
37
44
|
* @param env - The environment the door is read from.
|
|
38
45
|
* @returns An envelope carrying the link and its `fs.url` model.
|
|
39
46
|
*/
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
if (words.length > 1) {
|
|
43
|
-
exitCode_set(1);
|
|
44
|
-
return envelope_error('', undefined, `${chalk.red('Usage: url [path]')}\n`);
|
|
45
|
-
}
|
|
46
|
-
const absolute = words.length === 0 ? await session.getCWD() : await path_resolve(words[0]);
|
|
47
|
+
async function url_answer(path, env) {
|
|
48
|
+
const absolute = path === undefined ? await session.getCWD() : await path_resolve(path);
|
|
47
49
|
const door = (env[URL_DOOR_ENV] ?? '').trim();
|
|
48
50
|
const link = url_compose(door, absolute);
|
|
49
51
|
const rendered = door === ''
|
|
@@ -51,4 +53,52 @@ export async function builtin_url(args = [], env = process.env) {
|
|
|
51
53
|
: `${link}\n`;
|
|
52
54
|
return envelope_ok(rendered, { kind: 'fs.url', data: { path: absolute, url: link } });
|
|
53
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The `url` declaration over one environment, the one its door is read from.
|
|
58
|
+
*
|
|
59
|
+
* @param env - The environment.
|
|
60
|
+
* @returns The declaration.
|
|
61
|
+
*/
|
|
62
|
+
function urlCommand_make(env) {
|
|
63
|
+
return command_declare({
|
|
64
|
+
name: 'url',
|
|
65
|
+
grammar: URL_GRAMMAR,
|
|
66
|
+
help: {
|
|
67
|
+
summary: 'Print a link (a web address) that opens ARGUS at a path, to send to a colleague',
|
|
68
|
+
description: `Print a web address that opens ARGUS at a path: a feed or a node lands in RUNS, anything else in FILES. The path is the session's resolved absolute path, so the link names the same place for anyone the feed is shared with. The door comes from ${URL_DOOR_ENV}; without it the fragment alone is printed, with a word on what to put in front.`,
|
|
69
|
+
category: 'Sharing',
|
|
70
|
+
examples: [
|
|
71
|
+
'url # Where you stand',
|
|
72
|
+
'url /home/sandip.samal/feeds/feed_4389/pl-dicom_repack_639204',
|
|
73
|
+
'url . # Paste it to a colleague the feed is shared with',
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
holds: [],
|
|
77
|
+
handler: async (args) => url_answer(args.operands.path, env),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* `url [path]`: the declaration, its door read from the process's environment.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* commands_register({ declarations: [urlCommand] });
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export const urlCommand = urlCommand_make(process.env);
|
|
89
|
+
/**
|
|
90
|
+
* `url` over words already split.
|
|
91
|
+
*
|
|
92
|
+
* @param args - The path, optionally.
|
|
93
|
+
* @param env - The environment the door is read from.
|
|
94
|
+
* @returns An envelope carrying the link and its `fs.url` model, or the refusal of a bad line.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* await builtin_url(['.']);
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export async function builtin_url(args = [], env = process.env) {
|
|
102
|
+
return declaredCommand_run(env === process.env ? urlCommand : urlCommand_make(env), args);
|
|
103
|
+
}
|
|
54
104
|
//# sourceMappingURL=url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/builtins/fs/url.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/builtins/fs/url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAgD,MAAM,kCAAkC,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAW,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,YAAoB;IAC5D,MA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AAK;QACX,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE;YACJ,OAAO,EAAE,iFAAiF;YAC1F,WAAW,EAAE,sPAAsP,YAAY,kFAAkF;YACjW,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,yDAAyD;gBACzD,+DAA+D;gBAC/D,yFAAyF;aAC1F;SACF;QACD,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,KAAK,EAAE,IAAI,EAA4B,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;KACvF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAA2C,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAE/F;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAiB,EAAE,EAAE,MAAyB,OAAO,CAAC,GAAG;IACzF,OAAO,mBAAmB,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AAC5F,CAAC"}
|
package/dist/builtins/help.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { type HelpLookup } from './helpSections.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type CommandDeclaration } from '../core/commandDeclaration.js';
|
|
3
3
|
import type { CommandEnvelope } from '@fnndsc/menu';
|
|
4
|
-
/**
|
|
5
|
-
* Help-text registry keyed by builtin command name, for the commands not yet
|
|
6
|
-
* declared in one record: a declared command's help is generated from its
|
|
7
|
-
* declaration, and its entry leaves this table.
|
|
8
|
-
*/
|
|
9
|
-
export declare const helpText: Record<string, CommandHelp>;
|
|
10
4
|
/**
|
|
11
5
|
* Displays help text for a command.
|
|
12
6
|
*
|
|
@@ -36,16 +30,18 @@ export declare function commandHelp_get(command: string): string | undefined;
|
|
|
36
30
|
* Renders contextual help for one registered pipeline executable.
|
|
37
31
|
*
|
|
38
32
|
* @param name - Pipeline executable name as exposed in `/bin`.
|
|
33
|
+
* @param declaration - Its declaration, made from its manifest, when CUBE gave one: the usage and every node option come from it.
|
|
39
34
|
* @returns Pipeline-specific help text, terminated with a newline.
|
|
40
35
|
*/
|
|
41
|
-
export declare function pipelineExecutableHelp_render(name: string): string;
|
|
36
|
+
export declare function pipelineExecutableHelp_render(name: string, declaration?: CommandDeclaration): string;
|
|
42
37
|
/**
|
|
43
38
|
* Renders contextual help for one versioned plugin executable.
|
|
44
39
|
*
|
|
45
40
|
* @param name - Plugin executable name as exposed in `/bin`.
|
|
41
|
+
* @param declaration - Its declaration, made from CUBE's parameters, when CUBE gave one: the usage and every parameter come from it.
|
|
46
42
|
* @returns Plugin-specific help text, terminated with a newline.
|
|
47
43
|
*/
|
|
48
|
-
export declare function pluginExecutableHelp_render(name: string): string;
|
|
44
|
+
export declare function pluginExecutableHelp_render(name: string, declaration?: CommandDeclaration): string;
|
|
49
45
|
/**
|
|
50
46
|
* Renders a command's help text as a string.
|
|
51
47
|
*
|
|
@@ -90,7 +86,7 @@ export declare function args_checkHasHelpFlag(args: string[], command?: string):
|
|
|
90
86
|
* commands_register({ declarations: [helpCommand] });
|
|
91
87
|
* ```
|
|
92
88
|
*/
|
|
93
|
-
export declare const helpCommand:
|
|
89
|
+
export declare const helpCommand: CommandDeclaration<{
|
|
94
90
|
readonly operands: readonly [{
|
|
95
91
|
readonly name: "topic";
|
|
96
92
|
readonly kind: "word";
|