weaver-e9-assistant-cli 1.0.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/args.js +36 -0
- package/dist/auth-token.js +690 -0
- package/dist/auth.js +187 -0
- package/dist/blog.js +469 -0
- package/dist/cli.js +4041 -0
- package/dist/client.js +199 -0
- package/dist/config.js +124 -0
- package/dist/createcontext.js +41 -0
- package/dist/crypto.js +139 -0
- package/dist/cube.js +1633 -0
- package/dist/email.js +838 -0
- package/dist/fileutil.js +20 -0
- package/dist/kq.js +204 -0
- package/dist/links.js +34 -0
- package/dist/odoc.js +194 -0
- package/dist/pageopen.js +29 -0
- package/dist/parse.js +159 -0
- package/dist/querystate.js +38 -0
- package/dist/render.js +21 -0
- package/dist/report.js +50 -0
- package/dist/submissionplan.js +43 -0
- package/dist/submissionstate.js +81 -0
- package/dist/todoaskidea.js +54 -0
- package/dist/todobatch.js +154 -0
- package/dist/todocc.js +128 -0
- package/dist/todoforward.js +66 -0
- package/dist/todoreject.js +215 -0
- package/dist/todosubmit.js +277 -0
- package/dist/todotransfer.js +54 -0
- package/dist/util.js +25 -0
- package/dist/wfcreate.js +102 -0
- package/dist/wfform.js +194 -0
- package/dist/wfops.js +40 -0
- package/dist/wfreceiver.js +43 -0
- package/dist/wfstart.js +717 -0
- package/dist/wfsummary.js +89 -0
- package/dist/wfupload.js +78 -0
- package/dist/wfuser.js +60 -0
- package/dist/workflow.js +461 -0
- package/dist/workplan.js +394 -0
- package/package.json +25 -0
package/dist/args.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function parseArgs(argv) {
|
|
2
|
+
const args = { _: [], flags: {} };
|
|
3
|
+
for (let i = 0; i < argv.length; i++) {
|
|
4
|
+
const a = argv[i];
|
|
5
|
+
if (a.startsWith('--')) {
|
|
6
|
+
const key = a.slice(2);
|
|
7
|
+
// --key=value 形式
|
|
8
|
+
const eq = key.indexOf('=');
|
|
9
|
+
if (eq >= 0) {
|
|
10
|
+
args.flags[key.slice(0, eq)] = key.slice(eq + 1);
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
const next = argv[i + 1];
|
|
14
|
+
if (next === undefined || next.startsWith('--')) {
|
|
15
|
+
args.flags[key] = true;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
args.flags[key] = next;
|
|
19
|
+
i++;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
args._.push(a);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return args;
|
|
27
|
+
}
|
|
28
|
+
/** 取字符串型 flag;布尔/缺省返回 undefined。 */
|
|
29
|
+
export function flagStr(args, key) {
|
|
30
|
+
const v = args.flags[key];
|
|
31
|
+
return typeof v === 'string' ? v : undefined;
|
|
32
|
+
}
|
|
33
|
+
/** 取布尔型 flag。 */
|
|
34
|
+
export function flagBool(args, key) {
|
|
35
|
+
return args.flags[key] === true;
|
|
36
|
+
}
|