Skip to content

Commit 0f9577d

Browse files
committed
feat: [Help] default help text format
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent 1100d31 commit 0f9577d

File tree

13 files changed

+3168
-552
lines changed

13 files changed

+3168
-552
lines changed

__fixtures__/commands/bun.mts

Lines changed: 0 additions & 199 deletions
This file was deleted.

__fixtures__/commands/distinct.mts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* @module fixtures/commands/distinct
44
*/
55

6+
import chars from '#enums/chars'
67
import unique from '#parsers/unique'
78
import sfmt from '#tests/utils/sfmt'
89
import c from '@flex-development/colors'
@@ -15,7 +16,10 @@ import type { SubcommandInfo as CommandInfo } from '@flex-development/kronk'
1516
*/
1617
export default {
1718
arguments: {
18-
default: { value: new Set() },
19+
default: {
20+
description: c.redBright('new') + chars.space + c.blueBright('Set()'),
21+
value: new Set()
22+
},
1923
description: 'the list of numbers',
2024
parser: unique,
2125
syntax: sfmt.optional({ id: 'numbers', variadic: true })
@@ -28,5 +32,6 @@ export default {
2832
{ command: false as const, comment: '// 1 3', text: '3 1 3' },
2933
{ command: false as const, comment: '// show help', text: '--help' }
3034
].map(info => (info.text && (info.text = c.cyan(info.text)), info)),
31-
name: 'distinct'
35+
name: 'distinct',
36+
usage: { options: null }
3237
}

__fixtures__/commands/factorial.mts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import chars from '#enums/chars'
77
import integer from '#parsers/integer'
88
import sfmt from '#tests/utils/sfmt'
99
import c from '@flex-development/colors'
10-
import type { SubcommandInfo as CommandInfo } from '@flex-development/kronk'
10+
import type {
11+
SubcommandInfo as CommandInfo,
12+
ExampleInfo
13+
} from '@flex-development/kronk'
1114

1215
/**
1316
* The program info for `factorial`.
@@ -29,7 +32,10 @@ export default {
2932
{ comment: '// 6', text: '3' },
3033
{ comment: '// 6227020800', text: '13' },
3134
{ comment: '// show help and exit', text: '--help' }
32-
].map(info => (info.text && (info.text = c.yellow(info.text)), info)),
35+
].map((info: ExampleInfo) => {
36+
if (info.text) info.text = c.yellow(info.text)
37+
return info.command = c.bold('factorial'), info
38+
}),
3339
name: 'factorial',
3440
usage: { options: null },
3541
version: chars.empty

__fixtures__/commands/grease.mts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ export default {
165165
syntax: sfmt.optional({ id: 'candidate' })
166166
},
167167
description: 'Get a version bump recommendation.',
168+
examples: { text: [] },
168169
helpCommand: false,
169170
name: 'recommend',
170171
summary: 'get a recommended version bump'
@@ -256,6 +257,7 @@ export default {
256257
},
257258
manifest: {
258259
description: 'Manage the package manifest.',
260+
help: { globalOptions: false },
259261
helpCommand: false,
260262
options: {
261263
description: 'the manifest path or url',
@@ -371,6 +373,7 @@ export default {
371373
syntax: sfmt.required({ id: 'tag' })
372374
},
373375
description: 'Create a release tag.',
376+
help: { globalOptions: false },
374377
options: [
375378
{
376379
choices: bool.choices, // dprint-ignore-next

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,15 @@
157157
"dependencies": {
158158
"@flex-development/colors": "2.0.0",
159159
"@flex-development/fsm-tokenizer": "1.0.0-alpha.1",
160+
"@flex-development/string-wrap": "2.1.2",
161+
"@flex-development/strip-ansi": "1.0.0",
160162
"@flex-development/tutils": "6.0.0-alpha.25",
161163
"@types/semver": "7.7.1",
162164
"devlop": "1.1.0",
163165
"eventemitter2": "6.4.9",
164166
"micromark-util-character": "2.1.1",
165-
"plur": "6.0.0"
167+
"plur": "6.0.0",
168+
"string-width": "8.1.0"
166169
},
167170
"devDependencies": {
168171
"@arethetypeswrong/cli": "0.18.2",

0 commit comments

Comments
 (0)