Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
MIT License
Bot releases are hidden (Show)
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)
table: rename min/maxCellWidth to min/maxColWidth (#65) (c75b94c)
rowSpan
(9c05cc3)colSpan
(bb6cae9).fromJson()
method (4be3edd).body()
method to Table
(2526ff2)KeyCode.parse(data)
captures only the first character (#54) (f153909)ctrl + c
(110a07e).toString()
method (3af8850)1
(a6e6aa3)TableLayout
class (699c0d1).from()
and .clone()
method's (ddee9d7).versionOption()
and .helpOption()
method's (85d66b9)IGenericObject
interface (e3c8660)OptionType
type from IArgumentDetails
(c8dc229)ICommandOption
interface (88263b5)egg.yaml
config (f8447cc)command: remove BaseCommand
class (#27) (029aac5, 2bc4660)
All commands have to be created with the Command
class for now.
The help
and completions
commands are now optional and can be registered as descripted in the example below.
The --help
and --version
option will be registered only on the main command for now. The --help
option is a global option and available on all child-command's.
import { Command, HelpCommand, CompletionsCommand } from 'https://deno.land/x/cliffy/command.ts';
await new Command()
.command( 'help', new HelpCommand() )
.command( 'completions', new CompletionsCommand() )
.parse()
command: remove optional argument from boolean flags which was registered per default (#40) (94ea644)
An option defined with .option('-d, --debug', '...')
has no longer an boolean argument per default.
To add an boolean argument you have add the argument explicitly with .option('-d, --debug [arg:boolean]', '...')
flags: remove optional argument from boolean flags which was registered per default (#40) (00ac846)
A boolean flag no longer has an optional value per default. To add an optional or required value use the optionalValue
or requiredValue
option.
prepend
option to .option()
method (5164692).getGlobalParent()
method (a1d61c9).getParent()
and .getMainCommand()
method's (1a900be)this
in action handler (#28) (461145f)-n5
results in {n: 5}
but -abc
will still result in {a: true, b: true, c: true}
(775c528)--foo=bar
(53ba110)getGlobal*
methods does not return all globals (c7f5a5a)Secret
prompt only if hidden
is enabled (5ebf343)DefaultCommand
class (#27) (9e3913c, 9cdc2d2).reset()
method (ba85b2a)ArgumentsParser
util class (c30e474).complete()
method optional in custom type's (53a9af7)Select
prompt (a694881)Separator
class (31b41e4).stopEarly()
method (#39) (45f28e7).getRawArgs()
method (4f18db7)literal
arguments in .parse()
method and add .getLiteralArgs()
method (#26) (385f38f)stopEarly
option (#39) (ee683d3)minOptions
and maxOptions
option's to Checkbox
prompt (#38) (0980b42)minLength
, maxLength
, minTags
and maxTags
option to List
prompt (#37) (6836a7d)label
option to Secret
prompt (9127471)minLength
and maxLength
to Input
and Secret
prompt's (#36) (2b13fab)args
parameter optional in .parse()
method (fabfd32)ICommandMap
interface (eb3f578).getHelp()
method to HelpCommand
(9b96d10).name()
method and refactor internal name and path handling (#21) (362d8ea)CLIFFY_DEBUG
does not work (4e90d77)IGenericObject
(28fd483)IFlagsParseResult
to IParseResult
(eaeb634)ansi escape
module (#1) (0ac92c2)keycode
module (f61d033, 3be5b72, 9869720)prompt
module (#4) (df2221e)TextEncoder
for text encoding (b29e1ba)Table
class in help command (5f203d1)table: rewrite table module (65988b7)
Old table method's like table
and renderTable
are replaced by the new Table
class.
complete
sub-command to completions
command (fb63ec7)action
type (164585e)command
type (2b9608c)border
option (a785164)complete
method in custom type class's optional. (253cd74)completions
description (a3c5c72)validateFlags
method (2b51730)getOptions
method (3927c36)Deno.runTests()
in test's (57f3a34)