magic-builder 0.1.0 → 0.1.1
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/bin/magic-builder.js +15 -0
- package/package.json +1 -1
- package/src/lib/help.js +11 -0
package/bin/magic-builder.js
CHANGED
|
@@ -82,6 +82,16 @@ async function main() {
|
|
|
82
82
|
process.exit(0);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
if (argv[0] === 'help') {
|
|
86
|
+
process.stdout.write(renderHelp('help', argv[1]) + '\n');
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (argv[0] === 'man') {
|
|
91
|
+
process.stdout.write(renderHelp('man') + '\n');
|
|
92
|
+
process.exit(0);
|
|
93
|
+
}
|
|
94
|
+
|
|
85
95
|
const { command, args, opts } = parseGlobalArgs(argv);
|
|
86
96
|
|
|
87
97
|
if (!command) {
|
|
@@ -89,6 +99,11 @@ async function main() {
|
|
|
89
99
|
process.exit(0);
|
|
90
100
|
}
|
|
91
101
|
|
|
102
|
+
if (args[0] === 'help' || args[1] === 'help') {
|
|
103
|
+
process.stdout.write(renderHelp('help', command) + '\n');
|
|
104
|
+
process.exit(0);
|
|
105
|
+
}
|
|
106
|
+
|
|
92
107
|
try {
|
|
93
108
|
await COMMANDS[command].run(args, opts);
|
|
94
109
|
} catch (err) {
|
package/package.json
CHANGED
package/src/lib/help.js
CHANGED
|
@@ -8,6 +8,10 @@ BRIEF: CLI for Magic Builder (妙笔).
|
|
|
8
8
|
|
|
9
9
|
SYNTAX:
|
|
10
10
|
magic-builder <command> <subcommand> [options]
|
|
11
|
+
magic-builder <command> help
|
|
12
|
+
magic-builder <command> <subcommand> help
|
|
13
|
+
magic-builder help [command]
|
|
14
|
+
magic-builder man
|
|
11
15
|
|
|
12
16
|
COMMANDS:
|
|
13
17
|
auth Login and manage Magic developer tokens
|
|
@@ -23,6 +27,9 @@ COMMANDS:
|
|
|
23
27
|
|
|
24
28
|
EXAMPLES:
|
|
25
29
|
magic-builder auth login
|
|
30
|
+
magic-builder help page
|
|
31
|
+
magic-builder page help
|
|
32
|
+
magic-builder page publish help
|
|
26
33
|
magic-builder page publish app.html --title "Dashboard"
|
|
27
34
|
magic-builder page list --scope mine
|
|
28
35
|
magic-builder page export --id recxxx --out app.html
|
|
@@ -53,6 +60,10 @@ GLOBAL OPTIONS:
|
|
|
53
60
|
--version, -v Show version
|
|
54
61
|
--help, -h Show help
|
|
55
62
|
--man Show full manual
|
|
63
|
+
help [command] Show general or command help
|
|
64
|
+
<command> help Show command help
|
|
65
|
+
<command> <subcommand> help Show command help
|
|
66
|
+
man Show full manual
|
|
56
67
|
|
|
57
68
|
COMMANDS:
|
|
58
69
|
auth login [--no-open] [--timeout <seconds>] [--interval <seconds>]
|