Command line framework for deno π¦ Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
MIT License
Bot releases are hidden (Show)
jsr
upgrade provider (rework) (#692) (b976d26)DENO_FUTURE
on ci (#715) (318e2af)ansi,prompt: remove use of Deno.isatty()
and rid
(#672) (bcc7552)
This commit removes the rid
property from the reader
option and replaces the isTty
method with the isTerminal
method.
command: remove support for executable sub-commands (#682) (89475a8)
Publish to jsr (#679)
This is the first release on jsr.io and is used for initial testing. Cliffy is still published to deno.land, but as soon as jsr.io becomes stable, cliffy will probably only be published on jsr.io and no longer on deno.land.
flags: export InvalidTypeError
(#686) (e9a400a)
ansi: rename .toBuffer()
method to .bytes()
(#606) (853c2a6)
ansi: rename stdin
and stdout
options to reader
and writer
(#570) (8980c53)
flags: remove requiredValue
option and rename option.args[].optionalValue
to option.args[].optional
(#496) (f381e56)
before:
parseFlags(Deno.args, {
flags: [{
name: "foo",
type: "boolean",
requiredValue: true,
}, {
name: "bar",
args: [{
type: "string",
optionalValue: true,
}],
}]
});
after:
parseFlags(Deno.args, {
flags: [{
name: "foo",
type: "boolean",
optionalValue: false,
}, {
name: "bar",
args: [{
type: "string",
optional: true,
}],
}]
});
prompt: remove default indentation (#495) (16790ac)
To restore the old behavior, you can use the indent option:
await Input.prompt({
message: "What's your name?",
indent: " ",
});
prompt: deprecate SelectValueOptions
and CheckboxValueOptions
types (#526) (20ba587)
SelectValueOptions
-> Use Array<string | SelectOption>
instead.CheckboxValueOptions
-> Use Array<string | CheckboxOption>
instead.table: refactor table types (#559) (2b1ea19)
IBorder
-> Use Border
instead.ICell
-> Use CellType
instead.IRow
-> Use RowType
instead.IDataRow
-> Use DataRow
instead.IBorderOptions
-> Use BorderOptions
instead.ITable
-> Use TableType
instead..toArray()
method to ansi
module (#543) (ca2e7f6)--name
option to completion commands (#587) (f9368eb)reader
& writer
options to prompt()
function (#574) (72536ea).globalAction()
method (#555) (b76524f)prompt()
types and update docs (#578) (9487d8d)reader
and writer
options (#569) (8923a6f)Column
class (#554) (738355a).border()
method to true
(#557) (a43d845)opts.stdin.setRaw
instead of Deno.stdin.setRaw
intty
module and getCursorPosition
method and fiy stdin option types (#564) (0bc4cca)Array<unknown>
for arguments in .globalAction()
action handler (#607) (de75995).useRawArgs()
enabled (#549) (ecdb98e)OptionType
is exported as type (#636) (45890b9)2
as default for validation errors (#601) (6394f89)Deno.Command
api (#596) (90d9565)GenericInputPromptSettings
export from mod.ts (#614) (ad8be98)Password
to Secret
(#494) (ed49579)--unstable
flags from tests and examples (#550) (b8bd612)CONTRIBUTING.md
(#633) (d5d29d9)generateOption
method in zsh completions generator (#517) (eb53cd2).throw()
method (#508) (f07d37a)cmd
property to ValidationError
(#506) (27ae6cd)validateFlags
export from cliffy/mod.ts
(#485) (22938a8)Deno.consoleSize()
(#484) (096bb00)command: rename some types and deprecate old types (#474) (d56ad88)
The following types have been deprecated and renamed:
IArgument
-> Argument
ICommandGlobalOption
-> GlobalOptionOptions
ICommandOption
-> OptionOptions
ICompleteOptions
-> CompleteOptions
ICompletion
-> Completion
IEnvVar
-> EnvVar
IEnvVarOptions
-> EnvVarOptions
IExample
-> Example
IGlobalEnvVarOptions
-> GlobalEnvVarOptions
IOption
-> Option
IParseResult
-> CommandResult
IType
-> TypeDef
ITypeOptions
-> TypeOptions
IAction
-> ActionHandler
ICompleteHandler
-> CompleteHandler
IDescription
-> Description
IEnvVarValueHandler
-> EnvVarValueHandler
IFlagValueHandler
-> OptionValueHandler
IHelpHandler
-> HelpHandler
IVersionHandler
-> VersionHandler
TypeValue
-> Type.infer
flags: rename some types and deprecate old types (#473) (7615ed7)
The following types have been deprecated and renamed:
IParseOptions
-> ParseFlagsOptions
IFlagOptions
-> FlagOptions
IFlagArgument
-> ArgumentOptions
IDefaultValue
-> DefaultValue
IFlagValueHandler
-> ValueHandler
IFlagsResult
-> ParseFlagsContext
ITypeInfo
-> ArgumentValue
ITypeHandler
-> TypeHandler
OptionType
-> ArgumentType
equalsSign
option not working with type
option (#476) (08e7465)CommandType
and IntegerType
(#478) (22b8999)dotted
option (#456) (cd8d73c)stopOnUnknown
option (#453) (b2700e5)Deno.setRaw
to new Deno.stdin.setRaw
(#459) (e5b9416)UnexpectedOptionValue
error if no flags are defined (#450) (ed50ca3)command: flatten variadic arguments and fix types for variadic option arguments (#418) (bf5f15a)
Before:
new Command()
.arguments("[arg1] [arg2] [...restArgs]")
.action((_, arg1, arg2, restArgs) => {})
After:
new Command()
.arguments("[arg1] [arg2] [...restArgs]")
.action((_, arg1, arg2, ...restArgs) => {})
.noGlobals()
method (#403) (e37fb99)Deno.exit()
in help command when .noExit()
is called (#424) (41769ec).parseOptions()
method (#409) (58df99d)deno test
with --parallel
flag (#412) (1186435)deno.jsonc
config and use deno task
(#413) (5f28389).allowEmpty()
is called (#408) (2ba7386).parseCommand()
method (#404) (60b9dd7)command: refactor handling of optional options defined with an equals sign (#369) (a51e230)
Options defined with an equal sign must now also be called with an equal sign: --foo=bar
Options defined without an equal sign can be called with and without an equal sign as it was before: --foo bar
and --foo=bar
command: infer types and option names (#312) (efcad62)
With this release the Command
class is now strict by default. All names and types from option, argument and environment variable definitions will be now automatically inferred π
Previously it was necessary to pass the void
type as first generic argument to the command class Command<void>
(which is now the default) to enable strict typings.
The name and the type could than be specified by passing them to the option
, arguments
or env
methods:
new Command<void>()
.option<{ foo?: string }>("--foo <value:string>")
.arguments<[string, string?]>("<input> [output]")
This is no longer necessary. Names and types are now automatically inferred from the definitions "--foo <value:string>"
and you can define it just like the following example. Options and arguments will be automatically typed.
new Command()
.option("--foo <value:string>")
.arguments("<input> [output]")
Dotted options, custom types like EnumType
and options like default
, value
and prefix
are supported as well.
To disable strict types you can pass the any
type to the command class Command<any>
which was previously the default._
command: fix allowEmpty and disable it by default (#352) (c17718d)
Previously .allowEmpty()
was enabled by default, which means if an required option was registered no error was thrown if the command was called without any arguments.
.allowEmpty()
is now disabled by default and has to be enabled manually.
command: add new file type with path completion support (#353) (969f2dd)
If the CompletionCommand
is registered, path completions will be enabled for arguments and options with the file
type. The new file
type can be used as following:
new Command()
.option("--input-file <path:file>", "The input file.")`
command: show long version format with long --version option (#343) (079b4ba)
command: show hint in help if a new version is available (#342) (bc9cfbf)
command,flags: add support for wildcard options (#351) (e604e44)
Wildcard options can be used to allow options with dynamic names. You can register them as following:
new Command()
.option("--foo.*", "This options allows any name on the foo option.")
.option("--bar.*.*", "This options allows any nested name on the bar option.")
Following options are valid options for the --foo.*
option:
--foo.bar
--foo.baz
Following options are valid options for the --bar.*.*
option:
--foo.bar.baz
--foo.beep.boop
flags: add ignoreDefaults
option (#349) (22178af)
prompt: add n & p keys for next & previous and left & right for next & prev page (#345) (d568f37)
prompt: add hideDefault option (#344) (dc460b6)