Skip to content

Commit 3cf23f9

Browse files
molisanimkubilayk
authored andcommitted
docs: use new customUsage feature in docs
Signed-off-by: Michael Molisani <git@molisani.us>
1 parent d78fda3 commit 3cf23f9

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

docs/docs/features/argument-parsing/examples/boolean-flag.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export const root = buildCommand({
1919
docs: {
2020
brief: "Example for live playground with boolean flag",
2121
customUsage: [
22-
"--quiet",
23-
"--quiet=yes",
24-
"--noQuiet",
22+
{ input: "--quiet", brief: "Flag with no value" },
23+
{ input: "--quiet=yes", brief: "Flag with explicit value" },
24+
{ input: "--noQuiet", brief: "Negated flag" },
2525
],
2626
},
2727
});

docs/docs/features/command-routing/commands.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The parameters object is a specification of all of the parameters (arguments and
6868

6969
A base level of documentation is required, and more is always appreciated. All commands must specify a value for `brief` that contains a short line of text to be used when referring to this command throughout the help text of the application.
7070

71-
Optionally, you can further customize the help text for this specific command by including `fullDescription` or `customUsage`. The former will override `brief` in the command's help text and can contain multiple lines of text rather than just one. The `customUsage` property will replace the auto-generated usage lines, and is useful when there's some [additional validation of user inputs](../out-of-scope.mdx#cross-argument-validation) that isn't represented natively by Stricli.
71+
Optionally, you can further customize the help text for this specific command by including `fullDescription` or `customUsage`. The former will override `brief` in the command's help text and can contain multiple lines of text rather than just one. The `customUsage` property will replace the auto-generated usage lines, and is useful when there's some [additional validation of user inputs](../out-of-scope.mdx#cross-argument-validation) that isn't represented natively by Stricli. You can also provide an object with `input` and `brief` to print a description after the usage line.
7272

7373
```ts
7474
// output-next-line
@@ -84,6 +84,7 @@ buildCommand({
8484
customUsage: [
8585
"-a -b",
8686
"-c",
87+
{ input: "-d", brief: "Brief description of this use case" },
8788
],
8889
},
8990
...
@@ -98,6 +99,8 @@ run --help
9899
USAGE
99100
run -a -b
100101
run -c
102+
run -d
103+
Brief description of this use case
101104
run --help
102105

103106
This is the full description of the command.

packages/core/tests/application.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,11 @@ describe("Application", () => {
674674
},
675675
docs: {
676676
brief: "basic command",
677-
customUsage: ["custom usage 1", { input: "custom-two", brief: "enhanced custom usage 2" }, "custom usage 3"],
677+
customUsage: [
678+
"custom usage 1",
679+
{ input: "custom-two", brief: "enhanced custom usage 2" },
680+
"custom usage 3",
681+
],
678682
},
679683
});
680684
const appWithAlternateUsage = buildApplication(commandWithAlternateUsage, {

0 commit comments

Comments
 (0)