@basaltkit/cli 1.2.1 → 1.2.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/README.md +2 -0
- package/dist/parse.d.ts +10 -1
- package/dist/parse.js +16 -3
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -209,6 +209,8 @@ A Basalt plugin that registers the commands in the `'commands'` metadata bucket,
|
|
|
209
209
|
|
|
210
210
|
A minimal argument parser: the first "loose" word is the command; `--key=value` and `--flag` become flags. Returns `{ command: string | undefined, args: string[], flags: Record<string, string | boolean> }`.
|
|
211
211
|
|
|
212
|
+
A bare `--no-<name>` is the conventional **negation**: it yields `flags['<name>'] === false`, not `flags['no-<name>'] === true`. That is what makes documented opt-outs such as `basalt dev --no-routes` take effect — commands test `flags['routes'] !== false`. Only the bare form negates: `--no-cache=x` still parses as the literal key `no-cache`.
|
|
213
|
+
|
|
212
214
|
### `consoleIo(): CommandIo`
|
|
213
215
|
|
|
214
216
|
A `CommandIo` implementation that writes to the console (`console.log` / `console.error`; `table` renders via `renderTable`). It's the default for `runCli`.
|
package/dist/parse.d.ts
CHANGED
|
@@ -3,5 +3,14 @@ export interface ParsedArgv {
|
|
|
3
3
|
args: string[];
|
|
4
4
|
flags: Record<string, string | boolean>;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Minimal argv parser: first bare word is the command; `--key=value` and
|
|
8
|
+
* `--flag` become flags.
|
|
9
|
+
*
|
|
10
|
+
* A bare `--no-<name>` is the conventional **negation**: it sets
|
|
11
|
+
* `flags['<name>'] = false`, not `flags['no-<name>'] = true`. That is what makes
|
|
12
|
+
* documented opt-outs like `basalt dev --no-routes` actually take effect —
|
|
13
|
+
* commands test `flags['routes'] !== false`. Only the bare form negates:
|
|
14
|
+
* `--no-cache=x` still parses as the literal key `no-cache`.
|
|
15
|
+
*/
|
|
7
16
|
export declare function parseArgv(argv: string[]): ParsedArgv;
|
package/dist/parse.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Minimal argv parser: first bare word is the command; `--key=value` and
|
|
3
|
+
* `--flag` become flags.
|
|
4
|
+
*
|
|
5
|
+
* A bare `--no-<name>` is the conventional **negation**: it sets
|
|
6
|
+
* `flags['<name>'] = false`, not `flags['no-<name>'] = true`. That is what makes
|
|
7
|
+
* documented opt-outs like `basalt dev --no-routes` actually take effect —
|
|
8
|
+
* commands test `flags['routes'] !== false`. Only the bare form negates:
|
|
9
|
+
* `--no-cache=x` still parses as the literal key `no-cache`.
|
|
10
|
+
*/
|
|
2
11
|
export function parseArgv(argv) {
|
|
3
12
|
let command;
|
|
4
13
|
const args = [];
|
|
@@ -7,8 +16,12 @@ export function parseArgv(argv) {
|
|
|
7
16
|
if (token.startsWith('--')) {
|
|
8
17
|
const body = token.slice(2);
|
|
9
18
|
const eq = body.indexOf('=');
|
|
10
|
-
if (eq === -1)
|
|
11
|
-
|
|
19
|
+
if (eq === -1) {
|
|
20
|
+
if (body.startsWith('no-') && body.length > 3)
|
|
21
|
+
flags[body.slice(3)] = false;
|
|
22
|
+
else
|
|
23
|
+
flags[body] = true;
|
|
24
|
+
}
|
|
12
25
|
else
|
|
13
26
|
flags[body.slice(0, eq)] = body.slice(eq + 1);
|
|
14
27
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basaltkit/cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=22.5.0"
|
|
6
|
+
},
|
|
4
7
|
"description": "The 'basalt' command framework for Basalt apps: define commands, run them against a booted app, and inspect routes and schedules.",
|
|
5
8
|
"license": "MIT",
|
|
6
9
|
"type": "module",
|
|
10
|
+
"sideEffects": false,
|
|
7
11
|
"exports": {
|
|
8
12
|
".": {
|
|
9
13
|
"types": "./dist/index.d.ts",
|
|
@@ -14,7 +18,7 @@
|
|
|
14
18
|
"dist"
|
|
15
19
|
],
|
|
16
20
|
"dependencies": {
|
|
17
|
-
"@basaltkit/core": "^1.1
|
|
21
|
+
"@basaltkit/core": "^1.3.1"
|
|
18
22
|
},
|
|
19
23
|
"devDependencies": {
|
|
20
24
|
"@types/node": "^26.3.0",
|