8383 - [ ` Command#unknowns([strategy]) ` ] ( #commandunknownsstrategy )
8484 - [ ` Command#usage([usage]) ` ] ( #commandusageusage )
8585 - [ ` Command#version([version]) ` ] ( #commandversionversion )
86+ - [ ` Command#versionOption([version]) ` ] ( #commandversionoptionversion )
8687 - [ ` CommandEvent<T>(command) ` ] ( #commandeventtcommand )
8788 - [ ` CommandEvent#command ` ] ( #commandeventcommand )
8889 - [ ` CommandEvent#id ` ] ( #commandeventid )
135136 - [ ` Parseable#required ` ] ( #parseablerequired )
136137 - [ ` Parseable#toString() ` ] ( #parseabletostring )
137138 - [ ` Parseable#variadic ` ] ( #parseablevariadic )
138- - [ ` VersionOption(info) ` ] ( #versionoptioninfo )
139- - [ ` VersionOption#version ` ] ( #versionoptionversion )
140139 - [ ` keid ` ] ( #keid )
141140 - [ ` optionValueSource ` ] ( #optionvaluesource )
142141- [ Types] ( #types )
217216 - [ ` UnknownStrategy ` ] ( #unknownstrategy )
218217 - [ ` UsageData ` ] ( #usagedata )
219218 - [ ` UsageInfo ` ] ( #usageinfo )
220- - [ ` VersionData ` ] ( #versiondata )
221- - [ ` VersionOptionInfo ` ] ( #versionoptioninfo-1 )
219+ - [ ` VersionOptionData ` ] ( #versionoptiondata )
222220 - [ ` Version ` ] ( #version )
223221 - [ ` WriteStream ` ] ( #writestream )
224222 - [ ` Write ` ] ( #write )
@@ -663,19 +661,18 @@ Create a new unattached option.
663661##### Overloads
664662
665663- ` createOption(info: Flags | OptionInfo): Option `
666- - ` createOption(info: VersionOptionInfo): VersionOption `
667664- ` createOption(info: Flags, data?: OptionData | null | undefined): Option `
668665
669666##### Parameters
670667
671- - ` info ` ([ ` Flags ` ] ( #flags ) | [ ` OptionInfo ` ] ( #optioninfo-1 ) | [ ` VersionOptionInfo ` ] ( #versionoptioninfo-1 ) )
668+ - ` info ` ([ ` Flags ` ] ( #flags ) | [ ` OptionInfo ` ] ( #optioninfo-1 ) )
672669 — option info or flags
673670- ` data ` ([ ` OptionData ` ] ( #optiondata ) )
674671 — additional option info
675672
676673##### Returns
677674
678- ([ ` Option ` ] ( #optioninfo ) | [ ` VersionOption ` ] ( #versionoptioninfo ) ) New option instance
675+ ([ ` Option ` ] ( #optioninfo ) ) New option instance
679676
680677#### ` Command#default `
681678
@@ -903,6 +900,9 @@ Get the help text utility, configure the help text, or print the help text.
903900
904901Get or configure the help subcommand.
905902
903+ > 👉 ** Note** : No cleanup is performed when this method is called
904+ > with a different name (i.e. ` help ` as a string or ` help.name ` ).
905+
906906##### Overloads
907907
908908- ` helpCommand(help: HelpCommandData | null | undefined): this `
@@ -927,6 +927,9 @@ Get or configure the help subcommand.
927927
928928Get or configure the help option.
929929
930+ > 👉 ** Note** : No cleanup is performed when this method is called
931+ > with different flags (i.e. ` help ` as a string or ` help.flags ` ).
932+
930933##### Overloads
931934
932935- ` helpOption(help: HelpOptionData | null | undefined): this `
@@ -1284,33 +1287,55 @@ Get or set the command usage description.
12841287
12851288#### ` Command#version([version]) `
12861289
1287- Get or set the command version.
1288-
1289- > 👉 ** Note** : When setting the command version, this method auto-registers
1290- > the version option with the flags ` -v, --version ` .
1291- > No cleanup is performed when this method
1292- > is called with different flags (i.e. ` info ` as a string or ` info.flags ` ).
1290+ Get, set, or print the command version.
12931291
12941292##### Overloads
12951293
1296- - ` version(version: VersionData | null | undefined): this `
1294+ - ` version(version: Version | null | undefined): this `
12971295- ` version(version: true): undefined `
1298- - ` version<T extends string >(): T | null `
1296+ - ` version<T extends Version >(): T | null `
12991297
13001298##### Type Parameters
13011299
1302- - ` T ` (` string ` )
1300+ - ` T ` ([ ` Version ` ] ( #version ) )
13031301 — the command version
13041302
13051303##### Parameters
13061304
1307- - ` version ` ([ ` VersionData ` ] ( #versiondata ) | ` true ` | ` null ` | ` undefined ` )
1308- — the command version, version option instance, version option info, or ` true ` to print the command version
1305+ - ` version ` ([ ` Version ` ] ( #version ) | ` true ` | ` null ` | ` undefined ` )
1306+ — the command version or ` true ` to print the command version
13091307
13101308##### Returns
13111309
13121310(` T ` | [ ` this ` ] ( #commandinfo ) | ` null ` ) The command version or ` this ` command
13131311
1312+ #### ` Command#versionOption([version]) `
1313+
1314+ Get or configure the version option.
1315+
1316+ > 👉 ** Note** : No cleanup is performed when this method is called
1317+ > with different flags (i.e. ` version ` as a string or ` version.flags ` ).
1318+
1319+ ##### Overloads
1320+
1321+ - ` versionOption(version: VersionOptionData | null | undefined): this `
1322+ - ` versionOption<T extends Option>(): T | null `
1323+
1324+ ##### Type Parameters
1325+
1326+ - ` T ` ([ ` Option ` ] ( #optioninfo ) )
1327+ — the version option instance
1328+
1329+ ##### Parameters
1330+
1331+ - ` version ` ([ ` VersionOptionData ` ] ( #versionoptiondata ) | ` null ` | ` undefined ` )
1332+ — option flags, option instance, option info, ` false ` to disable the version option,
1333+ or any other allowed value to use the default configuration
1334+
1335+ ##### Returns
1336+
1337+ (` T ` | [ ` this ` ] ( #commandinfo ) | ` null ` ) Version option or ` this ` command
1338+
13141339### ` CommandEvent<T>(command) `
13151340
13161341A parsed command event (` class ` ).
@@ -1896,25 +1921,6 @@ Get the candidate as a human-readable string (`abstract`).
18961921
18971922Whether the candidate can be specified multiple times.
18981923
1899- ### ` VersionOption(info) `
1900-
1901- A command version option (` class ` ).
1902-
1903- #### Extends
1904-
1905- - [ ` Option ` ] ( #optioninfo )
1906-
1907- #### Parameters
1908-
1909- - ` info ` ([ ` Version ` ] ( #version ) | [ ` VersionOptionInfo ` ] ( #versionoptioninfo-1 ) )
1910- — command version or option info
1911-
1912- #### ` VersionOption#version `
1913-
1914- ` string `
1915-
1916- The version of the command.
1917-
19181924### ` keid `
19191925
19201926Default error ids (` const enum ` ).
@@ -1934,6 +1940,7 @@ const enum keid {
19341940 missing_argument = ' kronk/missing-argument' ,
19351941 missing_mandatory_option = ' kronk/missing-mandatory-option' ,
19361942 no_flags = ' kronk/no-flags' ,
1943+ required_argument_after_optional = ' kronk/required-argument-after-optional' ,
19371944 unknown_implied_option = ' kronk/unknown-implied-option' ,
19381945 unknown_option = ' kronk/unknown-option'
19391946}
@@ -2164,8 +2171,11 @@ Data transfer object for commands (TypeScript interface).
21642171- ` usage ? ` ([ ` UsageData ` ](#usagedata), optional)
21652172 — an object describing how the command is used
21662173 - default: ` { arguments: null , options: ' [options]' , subcommand: ' [command]' }`
2167- - ` version ? ` ([ ` VersionData ` ](#versiondata), optional)
2168- — command version configuration
2174+ - ` version ? ` ([ ` Version ` ](#version), optional)
2175+ — the command version
2176+ - ` versionOption ? ` ([ ` VersionOptionData ` ](#versionoptiondata), optional)
2177+ — customize the version option
2178+ - default: ` { description: ' print version number' , flags: ' -v, --version' }`
21692179
21702180### ` CommandErrorInfo `
21712181
@@ -2293,7 +2303,7 @@ Command metadata (TypeScript interface).
22932303 — the parent command
22942304- ` subcommands ` ([ ` Map <string , Command >` ](#commandinfo))
22952305 — map, where each key is the name of a subcommand each value is a subcommand
2296- - ` version ` ([ ` VersionOption ` ](#versionoptioninfo ) | ` null ` | ` undefined ` )
2306+ - ` versionOption ` ([ ` Option ` ](#optioninfo ) | ` null ` | ` undefined ` )
22972307 — the version option
22982308
22992309### ` CommandName `
@@ -2486,14 +2496,13 @@ type HelpCommandData =
24862496
24872497### ` HelpOptionData `
24882498
2489- Union of types used to configure the help option (TypeScript type).
2499+ Union of types used to configure the command help option (TypeScript type).
24902500
2491- The command help option can be customized with
2492- an [ ` Option ` ](#optioninfo) instance, [flags](#flags), or an [info object](#optioninfo-1).
2493- It can also be disabled ( ` false ` ).
2501+ The help option can be customized with an [ ` Option ` ](#optioninfo) instance, [flags](#flags),
2502+ or an [info object](#optioninfo-1). It can also be disabled ( ` false ` ).
24942503
24952504` ` ` ts
2496- type HelpOptionData = Flags | Option | OptionInfo | OptionData | boolean
2505+ type HelpOptionData = Flags | Option | OptionData | OptionInfo | boolean
24972506` ` `
24982507
24992508### ` HelpTextOptions `
@@ -3219,30 +3228,17 @@ Command usage info (TypeScript interface).
32193228 — the descriptor
32203229 > 👉 **note**: displayed in auto-generated help text **only** when a command has at least one visible subcommand
32213230
3222- ### ` VersionData `
3231+ ### ` VersionOptionData `
32233232
3224- Union of types used to configure the version of a [ ` Command ` ](#commandinfo) (TypeScript type).
3233+ Union of types used to configure the command version option (TypeScript type).
3234+
3235+ The version option can be customized with an [ ` Option ` ](#optioninfo) instance, [flags](#flags),
3236+ or an [info object](#optioninfo-1). It can also be disabled ( ` false ` ).
32253237
32263238` ` ` ts
3227- type VersionData = Version | VersionOption | VersionOptionInfo
3239+ type VersionOptionData = Flags | Option | OptionData | OptionInfo | boolean
32283240` ` `
32293241
3230- ### ` VersionOptionInfo `
3231-
3232- Data used to create command version options (i.e. ` -v , --version ` ) (TypeScript interface).
3233-
3234- #### Extends
3235-
3236- - [ ` OptionData ` ](#optiondata)
3237-
3238- #### Properties
3239-
3240- - ` flags ? ` ([ ` Flags ` ](#flags), optional)
3241- — option flags
3242- - default: ` ' -v, --version' `
3243- - ` version ` ([ ` Version ` ](#version))
3244- — the command version
3245-
32463242### ` Version `
32473243
32483244Union of command version types (TypeScript type).
0 commit comments