@bunizao/cli-kit 0.7.0 → 0.7.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/README.md +2 -1
- package/dist/program.d.ts +2 -0
- package/dist/program.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,7 +145,8 @@ preserve that status without reporting it. Usage failures throw for the boundary
|
|
|
145
145
|
## Mutations
|
|
146
146
|
|
|
147
147
|
Call `mutating(command)` for `send`, `submit`, `set`, and `mark-read` commands. The marker is
|
|
148
|
-
included by `commandsJson
|
|
148
|
+
included by `commandsJson`; a CLI that describes its own command tree reads it with
|
|
149
|
+
`isMutating(command)` instead of guessing from command names. Command actions call `confirm` before making an upstream request:
|
|
149
150
|
|
|
150
151
|
```ts
|
|
151
152
|
const shouldApply = await confirm(
|
package/dist/program.d.ts
CHANGED
|
@@ -37,4 +37,6 @@ export declare function createProgram(meta: {
|
|
|
37
37
|
description: string;
|
|
38
38
|
}): Command;
|
|
39
39
|
export declare function mutating(command: Command): Command;
|
|
40
|
+
/** Whether `mutating` marked this command, for a CLI that describes its own command tree. */
|
|
41
|
+
export declare function isMutating(command: Command): boolean;
|
|
40
42
|
export declare function commandsJson(program: Command): ProgramDescription;
|
package/dist/program.js
CHANGED
|
@@ -41,6 +41,10 @@ export function mutating(command) {
|
|
|
41
41
|
mutations.add(command);
|
|
42
42
|
return command;
|
|
43
43
|
}
|
|
44
|
+
/** Whether `mutating` marked this command, for a CLI that describes its own command tree. */
|
|
45
|
+
export function isMutating(command) {
|
|
46
|
+
return mutations.has(command);
|
|
47
|
+
}
|
|
44
48
|
export function commandsJson(program) {
|
|
45
49
|
return {
|
|
46
50
|
name: program.name(),
|