v0.13.0
Features
- prompt: add support for prompt list and dynamic prompts (6968c1d)
Bug Fixes
- flags: standalone parameter incompatible with dashed parameter which has a default value (1aa9b55)
- prompt: cursor not visible after error (1de8a84)
Performance Improvements
- command,flags: implement simple camel-case and remove param-case and snake-case methods to improve performance (20dc077, 4587284)
Code Refactoring
- remove format utils method (2496431)
- refactor project structure for url friendly imports (8b5fbdd)
- ansi-escape: add return types (2bb165c)
- command: re-export flag types in command module and some refactorings (05b3c9e)
- command: refactor error message (6f6e750)
- command: remove some helper methods: write, writeError, log, logError from command class (88bdc95)
- command: refactor completions command description and disable unimplemented bash completions command (a181cbb)
- command: add version option only if version is set (32e6687)
- prompt: remove read-line module and move methods to generic prompt class (dd1de10)
Style
- ansi-escape: add semicolons (7ed6424)
Chore
Documentation Updates
BREAKING CHANGES
-
command: refactor external sub-commands (#66) (6181747)
Following line no longer registers an external command.
new Command() .command( 'sub-command', 'description...' ) // // is same as new Command() .command( 'sub-command' ) .description( 'description...' )
To register an external command you have to use the
.external()
method for now.new Command() .command( 'sub-command', 'description...' ) .external() // is same as new Command() .command( 'sub-command' ) .description( 'description...' ) .external()
-
command,flags: refactor type handler (bf12441)
To make types compatible with environment variable and arguments the arguments of the type handler has changed from:
const myType: ITypeHandler<number> = ( option: IFlagOptions, arg: IFlagArgument, value: string ): number => {};
to:
const myType: ITypeHandler<number> = ( { label, name, value, type }: ITypeInfo ): number => {};
This makes it possible to write a single error messages for different contexts.
throw new Error( `${ label } ${ name } must be of type ${ type } but got: ${ value }` );
For options the error message will be:
Option --my-option must be of type number but got: abc
For environment variables the error message will be:Environment variable MY_ENV_VAR must be of type number but got: abc
For arguments the error message will be:Argument my-argument must be of type number but got: abc
-
command,flags: rename some types (0645313)
- ICompletionSettings -> ICompletion
- IArgumentDetails -> IArgument
- ITypeOption -> ITypeOptions
- ITypeSettings -> ITypeInfo
- IEnvVariable -> IEnvVar
- IEnvVarOption -> IEnvVarOptions
-
table: rename min/maxCellWidth to min/maxColWidth (#65) (c75b94c)