Releases: c4spar/deno-cliffy
v0.23.1
Bug Fixes
- command: add missing default types for the FileType type (#361) (559bb4a)
- command: only first argument of rest arguments is completed with zsh completions (#359) (dc0c1de)
- command: first argument is also completed on index two (#358) (1784eef)
- command: zsh completion action not called for arguments (#357) (1a62fe8)
- command: fix option types for useRawArgs (#356) (7acac27)
Chore
- upgrade: deno/[email protected], [email protected] (#362) (a6e4b45)
v0.23.0
BREAKING CHANGES
-
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 classCommand<void>
(which is now the default) to enable strict typings.
The name and the type could than be specified by passing them to theoption
,arguments
orenv
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 likedefault
,value
andprefix
are supported as well.To disable strict types you can pass the
any
type to the command classCommand<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.
Features
-
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 thefile
type. The newfile
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
-
prompt: add n & p keys for next & previous and left & right for next & prev page (#345) (d568f37)
Bug Fixes
- suggestions value is always lower cased (#346) (5d1e3a7)
- command: default value from option overrides env var (#350) (2cd7735)
- prompt: prompt is not rendered properly if content is longer than the terminal (#347) (56755e1)
Code Refactoring
- flags: infer option types in option callback method (#348) (483bbf7)
- prompt: improve generic types for prompt methd (#335) (42e21f6)
Documentation Updates
Chore
- upgrade: deno/[email protected] & [email protected] (#354) (f63b687)
v0.22.2
Features
- command: add support to show additional information in help text (#300) (e32f826)
- command: add support for enum's in EnumType (#316) (d71071e)
- prompt: add support for path completion and dynamic suggestions (#306) (0be6da7)
Bug Fixes
- command: only first missing required variadic option throws an error (#331) (cf487de)
- command: integer argument with value 0 is ignored (#329) (11b824c)
- prompt: checkbox and select prompt fails with only one disabled option (#328) (683f260)
- table: chinese characters are not aligned correctly (#330) (e31b680)
Performance Improvements
Code Refactoring
Chore
- add funding (ebafd0e)
- ci: use denoland/setup-deno in lint workflow (#332) (63b47d0)
- command: add script to update all test fixtures (#301) (89cc617)
- fmt: fmt readme (#305) (8c63fd8)
- fmt: fmt changelog (6d51275)
- upgrade: deno/std0.130.0 (#333) (336f0a1)
Documentation Updates
- prompt: add info for required --unstable flag (beca790)
v0.20.1
v0.20.0
Features
Bug Fixes
- command: help text shows always long description for env vars (#289) (6201e28)
- command: fix description column definition in help text (#286) (bf727fb)
- command: highlight command usage in help text (#288) (7181724)
Chore
BREAKING CHANGES
-
command: execute command action after option action is called (#285) (9170a65)
Prior to v0.20.0, when an option action was executed, the command action was not executed. Since v0.20.0, this has changed. The command action is now executed by default. Only standalone options do not execute the command actions (for more informations see the docs).
v0.19.6
v0.19.5
Features
- command: support import map in upgrade command (#265) (b400131)
- command: add support for required env vars (#261) (ee69526)
- command: make parsed environment variables available via command options (#263) (102161e)
- command: add prefix to environment variable options (#268) (44c80c8)
await new Command<void>()
.env<{ outputFile?: string }>(
"CC_OUTPUT_FILE=<value:string>",
"The output file.",
{ prefix: "CC_" },
)
.option<{ outputFile?: string }>(
"--output-file <value:string>",
"The output file.",
)
.action((options) => console.log(options.outputFile))
.parse();
$ CC_OUTPUT_FILE=foo.txt deno run example.ts
foo.txt
$ CC_OUTPUT_FILE=foo.txt deno run example.ts --output-file bar.txt
bar.txt
Bug Fixes
Code Refactoring
- command: refactor executable sub-commands (#259) (a13c79f)
- command: remove extra new line from getHelp() and completion generator methods (#257) (99ccc2a)
- table: use console.log to render output (#258) (4f05fad)
Chore
- ci: update release workflow (65ba62a, 1c6dc9d)
- ci: add codecov config (#267) (c54627a)
- codecov: upgrade to codecov/codecov-action@v2 (#266) (18c023c)
- upgrade: deno/std v0.104.0 (#270) (15af5bf)
Documentation Updates
v0.19.4
Bug Fixes
- command,flags: equals sign not supported in option value (#253) (b074cb3)
- command,flags: values starting with '-' not supported (#251) (ab598bf)
- command,flags: required option value with default value is not required (#249) (0d3f8fa)
- flags: allow collecting options by default if no flags are set (#252) (24e3f46)
Chore
v0.19.3
Features
Bug Fixes
- command: external commands not working on windows (#224) (84ac5be)
- command: remove v prefix from version in generated help text (#231) (f882abd)
- command,flags: don't normalize arguments if stopEarly is enabled (#246) (2ea4938)
- prompt: use exit code 130 for ctrl+c (#242) (2c014d7)
Code Refactoring
- command: export github upgrade provider in upgrade/mod.ts (#232) (39a8075)
- prompt: replace deprecated Deno.copy with copy method from std/io (#243) (f95b317)
Chore
- ci: use denoland/setup-deno action (#219) (d93ad7d)
- ci: use latest deno version in release action (36c1c07)
- ci: upgrade eggs to v0.3.8 (1efd809)
- egg: add keypress module to egg.yaml (fee6ed4)
- upgrade: deno/std v0.101.0 (#244) (534094b)