cli-five 0.1.1 → 0.1.2
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/package.json +1 -1
- package/src/cli.mjs +11 -0
package/package.json
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import kleur from 'kleur';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { join } from 'node:path';
|
|
2
5
|
import { init } from './commands/init.mjs';
|
|
3
6
|
import { doctor } from './commands/doctor.mjs';
|
|
4
7
|
import { listStacks } from './commands/list-stacks.mjs';
|
|
@@ -23,6 +26,7 @@ ${kleur.bold('Flags')}
|
|
|
23
26
|
--no-skills Skip the skills.sh discovery step
|
|
24
27
|
--cost-mode <m> Override cost mode (premium, cheap, mixed) — skips interview question
|
|
25
28
|
--cwd <path> Run against a directory other than the current one
|
|
29
|
+
--version, -v Print version and exit
|
|
26
30
|
`;
|
|
27
31
|
|
|
28
32
|
export async function run(argv) {
|
|
@@ -41,6 +45,12 @@ export async function run(argv) {
|
|
|
41
45
|
case '-h':
|
|
42
46
|
process.stdout.write(HELP);
|
|
43
47
|
return;
|
|
48
|
+
case '--version':
|
|
49
|
+
case '-v': {
|
|
50
|
+
const pkg = JSON.parse(readFileSync(join(fileURLToPath(new URL('.', import.meta.url)), '..', 'package.json'), 'utf8'));
|
|
51
|
+
process.stdout.write(`cli-five v${pkg.version}\n`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
44
54
|
default:
|
|
45
55
|
process.stderr.write(kleur.red(`Unknown command: ${cmd}\n\n`));
|
|
46
56
|
process.stdout.write(HELP);
|
|
@@ -59,6 +69,7 @@ function parse(argv) {
|
|
|
59
69
|
else if (a === '--cost-mode') out.costMode = argv[++i];
|
|
60
70
|
else if (a === '--cwd') out.cwd = argv[++i];
|
|
61
71
|
else if (a === '--help' || a === '-h') out._.push('help');
|
|
72
|
+
else if (a === '--version' || a === '-v') out._.push('--version');
|
|
62
73
|
else out._.push(a);
|
|
63
74
|
}
|
|
64
75
|
return out;
|