deno-cliffy

Command line framework for deno πŸ¦• Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...

MIT License

Stars
870
Committers
38

Bot releases are hidden (Show)

deno-cliffy - Latest Release

Published by c4spar 4 months ago

Features

  • add built-in jsr upgrade provider (rework) (#692) (b976d26)
  • publish to jsr.io (#679) (ff14148)
  • ansi,keypress,prompt: add support for node.js (#720) (1e1c2e6)
  • command: add support for nodejs (#693) (f81e895)
  • command: add support for node and bun to upgrade command (#705) (7011ada)
  • command: support zsh fpath completion (#703) (f770de2)
  • command: add npm upgrade provider (#701) (45dbe30)

Bug Fixes

  • prompt: expand input value if file suggestions are enabled (#719) (e377f04)
  • prompt: fix validation and return type of object option values for checkbox and seleect prompt (#718) (3e92792)

Code Refactoring

  • command: add exports for completions and upgrade provider (#700) (6d08b9a)

Chore

  • replace conditional_type_checks with @std/testing/types (#699) (2bc19f7)
  • ci: enable DENO_FUTURE on ci (#715) (318e2af)
  • ci: upgrade codecov-action to v4 (#708) (7a932da)
  • deps: upgrade @std to latest version (#721) (a6d2bc9)
  • deps: upgrade @std to latest version (#714) (c74892b)
  • lint: remove unused null coalescing operator (#713) (da5d7b2)

Unit/Integration Tests

  • command: add provider tests (#706) (10d9254)
  • command,prompt: fix tests (#697) (fe9726d)

deps

  • upgrade: upgrade @std/* to latest version (#704) (4e62e39)
deno-cliffy -

Published by c4spar 6 months ago

BREAKING CHANGES

  • 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)

Features

  • 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)

Bug Fixes

  • command: file type completion not working for first argument in zsh completions (#688) (a5cd35e)
  • command: zsh completion for command aliases not working (#688) (2351c77)
  • command: arg with no completions followed by args with completions breaks zsh completion (#688) (53551ac)
  • command: use ValidationError from command module instead of flags module in upgrade command (#684) (a568c39)
  • command: infer option default value as const (#660) (c91ddb6)
  • command: command action not triggered for standalone options without action handler (#654) (4e63862)
  • command: escape colons in subCommand name for zsh completions (#661) (aa1311f)
  • prompt: fix initial page offset for checkbox and select prompt (#689) (da56395)
  • table: Wrap ANSI codes for multiline cells (#657) (5118a1c)

Code Refactoring

  • command,flags: move some utils functions (#683) (6319a78)
  • flags,prompt: remove distance method and use std/text (#681) (181e055)

Chore

Unit/Integration Tests

  • command: add file type completion test for zsh (#688) (fba0969)

Documentation Updates

  • command: fix markdown formatting for arguments (#677) (#678) (6e67dca)
deno-cliffy -

Published by c4spar about 1 year ago

Features

  • add select all option to checkbox prompt (#649) (5f2c4f8)

Bug Fixes

  • prompt: disabled options can be selected with next page & previous page keys (#646) (6f3ba29)
  • prompt: incorrect info message shown for checkbox prompt on submit (#643) (fd6831c)

Chore

Unit/Integration Tests

  • prompt: test confirmSubmit option from checkbox prompt (#644) (5d3bf0a)

Documentation Updates

  • remove unstable notice (#652) (99ca3cf)
deno-cliffy -

Published by c4spar over 1 year ago

Bug Fixes

  • prompt: fix separator option for select prompt (#640) (937f58a)

Chore

  • add check:examples task (#641) (4fd91b6)
deno-cliffy -

Published by c4spar over 1 year ago

BREAKING CHANGES

  • 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: " ",
    });
    

DEPRECATIONS

  • 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.

Features

  • ansi: add .toArray() method to ansi module (#543) (ca2e7f6)
  • command: show required options in help usage (#598) (bd08f4b)
  • command: add --name option to completion commands (#587) (f9368eb)
  • command: add reader & writer options to prompt() function (#574) (72536ea)
  • command: support multiple option actions (#567) (4fb4f9a)
  • command: add .globalAction() method (#555) (b76524f)
  • prompt: add format option to select and checkbox prompt (#626) (5b8bc2d)
  • prompt: allow any type as value for select and checkbox prompt (#625) (20b59ec)
  • prompt: add support for multi level options for select and checkbox prompt (#445) (880d472)
  • prompt: refactor and export un-exported prompt() types and update docs (#578) (9487d8d)
  • prompt: add reader and writer options (#569) (8923a6f)
  • table: implement Column class (#554) (738355a)
  • table: set default value for .border() method to true (#557) (a43d845)
  • testing: add testing module (#581) (5db0f6e, 36c8dbe, 6a8ad25, d20d31c)

Bug Fixes

  • ansi: use opts.stdin.setRaw instead of Deno.stdin.setRaw intty module and getCursorPosition method and fiy stdin option types (#564) (0bc4cca)
  • ansi: color methods ignore an empty string argument (#558) (39eb048)
  • command: use Array<unknown> for arguments in .globalAction() action handler (#607) (de75995)
  • command: global parent action handlers are executed if noGlobals is enabled (#603) (b7e34fa)
  • command: enum type not always inferred correctly (#573) (31ba2ff)
  • command: incorrect validation when parsing global options with default values mixed with non-global options (#548) (ddd3e53)
  • command: error handler not triggered with .useRawArgs() enabled (#549) (ecdb98e)
  • flags: OptionType is exported as type (#636) (45890b9)
  • flags: default value for no-value-flag cannot be overridden (#551) (456eb41)
  • table: more accurate cell width for unicode chars (#632) (d29dce4)
  • table: apply column options only to table body (#608) (a7db939)
  • table: fix hasBodyBorder method (#560) (36d3d5d)
  • table: full width characters are not aligned correctly (#542) (9fea2ac)
  • table: japanese characters are not aligned correctly (#541) (44e48ea)

Code Refactoring

  • remove main mod.ts (#638) (7de3ddc)
  • ansi: use explicit exports in mod.ts (#610) (7e7063a)
  • command: move checkVersion method to separate file (#623) (a7a2d10)
  • command: remove indentation from help output (#605) (e9ab46a)
  • command: re-organize types (#602) (277fb27)
  • command: use exit code 2 as default for validation errors (#601) (6394f89)
  • command: improve error message for duplicate option names (#600) (1ef9e68)
  • command: throw an error if the command name is missing when generating shell completions (#599) (fa804b5)
  • command: switch to Deno.Command api (#596) (90d9565)
  • command: set default value for ignore and only in snapshotTest method (#588) (7f0ec49)
  • flags: use explicit exports in mod.ts (#609) (dd857d7)
  • keycode: use explicit exports in mod.ts (#611) (eb4d7a0)
  • prompt: remove GenericPrompt, GenericInput & GenericList exports (#627) (19a19f4)
  • prompt: remove unnecessary border arguments (#617) (ca6c705)
  • prompt: remove GenericInputPromptSettings export from mod.ts (#614) (ad8be98)
  • prompt: use explicit exports in mod.ts (#612) (f5dead8)
  • prompt: change default search icon to πŸ”Ž (#577) (52830a8)
  • prompt: remove windows encoding workaround (#566) (11e379f)
  • prompt: change default label of secret prompt from Password to Secret (#494) (ed49579)

Chore

Unit/Integration Tests

  • prompt: test also stderr in integration tests (#565) (6fa7ef5)
  • prompt: improve integration tests (#544) (986168f)

Documentation Updates

  • fix discussions link in CONTRIBUTING.md (#633) (d5d29d9)
  • ansi: documentation improvements (#621) (2928a6f)
  • ansi: update examples (#571) (82af874)
  • command: documentation improvements (#622) (e8b7da5)
  • flags: documentation improvements (#620) (46392b1)
  • keypress: documentation improvements (#619) (385b483)
  • keypress: documentation improvements (#618) (2070858)
  • prompt: update select & checkbox docs (#628) (02949d6)
  • prompt: documentation improvements (#616) (51dd46b)
  • table: documentation improvements (#615) (c67e441)
deno-cliffy -

Published by c4spar almost 2 years ago

Bug Fixes

  • prompt: suggestions are not completed if input is empty (#528) (06f71aa)
  • prompt: suggestions only work with lowercase input (#527) (9da2288)

Code Refactoring

  • command: use brightBlue and brightMagenta instead of blue and magenta in command output (#533) (c9e69e2)
  • command: show expected values in error message for invalid boolean value (#534) (9d47a5e)
  • prompt: use brightBlue instead of blue in prompt output (#530) (d7388a7)
deno-cliffy -

Published by c4spar almost 2 years ago

Bug Fixes

  • command: single quotes in option description breaks fish completions (#518) (c09c74a)
  • command: zsh completion broken for options without aliases (#515) (f65465a)
  • kecode: char property not set for space key (#519) (eafa1be)

Code Refactoring

  • command: refactor generateOption method in zsh completions generator (#517) (eb53cd2)

Chore

Unit/Integration Tests

  • prompt: test spaces in input prompt (#520) (a68c9d5)
deno-cliffy -

Published by c4spar almost 2 years ago

Features

  • command: expose .throw() method (#508) (f07d37a)
  • command: add cmd property to ValidationError (#506) (27ae6cd)
  • command: add error handler (#505) (a9f55b2)
  • keypress: add char property to KeyPressEvent (#504) (0b655c7)
  • keycode: add char property to KeyCode and support more special chars (#501) (b0db79e)

Bug Fixes

  • command: add missing await to catch validation error correctly (#500) (f33161a)
  • command: export UpgradeCommand from command/mod.ts (#482) (fee48bf)
  • prompt: ignore special key like F1, escape, etc. in input prompts (#502) (1e444a7)
  • prompt: grammar longer then to longer than (#497) (1b6b563)

Code Refactoring

  • prompt: refactor handleEvent method in input prompt (#503) (94fa06b)
  • prompt: use long names for generic parameters (#491) (f2a0d2a)

Chore

Unit/Integration Tests

  • prompt: use assertSnapshot for snapshot tests (#493) (e3a2d65)

Documentation Updates

  • command: update example (572c44f)
  • command: add example for .throw() method (#509) (dd4d33d)
  • command: add missing await in command examples (#507) (1443b38)
  • examples: don't use deprecated OptionType (#487) (a9a0a98)
deno-cliffy -

Published by c4spar almost 2 years ago

Bug Fixes

  • remove no longer existing validateFlags export from cliffy/mod.ts (#485) (22938a8)
  • prompt: add support for stabilized Deno.consoleSize() (#484) (096bb00)

Chore

deno-cliffy -

Published by c4spar almost 2 years ago

DEPRECATIONS

  • 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

Bug Fixes

  • command: remove duplicate "Missing argument" in error message (#471) (ee52235)
  • command: escape single quotes in command description for zsh completions (#467) (0b82722)
  • command,flags: value gets ignored if value of an option with an equals sign starts with a dash (#477) (517795a)
  • flags: value of combined short flags with equals sign is assigned to wrong option (#479) (dc29ab5)
  • flags: equalsSign option not working with type option (#476) (08e7465)

Code Refactoring

  • command: export CommandType and IntegerType (#478) (22b8999)
  • command: use full names for generic parameters (#475) (d93d2e0)
  • command,flags: rename errors (#470) (eb046b2)
  • flags: refactor arguments parsing (#480) (273dd41)

Chore

Documentation Updates

deno-cliffy -

Published by c4spar about 2 years ago

Features

  • command: re-implement support for passing global options before sub-commands (#444) (5ff1575)
  • flags: add dotted option (#456) (cd8d73c)
  • flags: add stopOnUnknown option (#453) (b2700e5)
  • flags: return matched standalone option (#451) (6c5e27c)
  • flags: implement parse context (#448) (5890402)

Bug Fixes

  • switch from Deno.setRaw to new Deno.stdin.setRaw (#459) (e5b9416)
  • command: fix type errors with typescript => 4.8 (#460) (9763bd4)
  • command,flags: throw an error if an option without a value has a value (#443) (166101f)
  • flags: don't throw UnexpectedOptionValue error if no flags are defined (#450) (ed50ca3)

Code Refactoring

  • command: throw to many arguments error for global & none global option before a sub-command (#454) (78eec2d)
  • flags: refactor stop early parsing (#449) (e48fc0f)

Chore

deno-cliffy -

Published by c4spar about 2 years ago

Bug Fixes

  • command: help text of main command is always shown for validation errors (#441) (41b3547)

Chore

Revert

  • feat(command): support passing global options before sub-command (#388) (#440) (85d3dac)
deno-cliffy -

Published by c4spar about 2 years ago

BREAKING CHANGES

  • 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) => {})
    

Features

  • command: add .noGlobals() method (#403) (e37fb99)
  • table: allow undefined cell values and override them with row and col span (#427) (89fe0ca)

Bug Fixes

  • command: required options with conflicting options should be optional (#435) (4c71af1)
  • command: type error when trying to add a command instance with child commands (#386) (35fe1de)
  • command: use instance properties for shouldThrowErrors and shouldExit check (#426) (21d7558)
  • command: don't call Deno.exit() in help command when .noExit() is called (#424) (41769ec)
  • command: ignore missing required env vars for global help option (#423) (0290828)
  • command: ignore missing required env vars for help and version option (#415) (275b337)
  • command: do not require full env permission (#416) (bc4c1bd)
  • table: max call stack error thrown for large tables (#433) (f699178)
  • table: error when first row is empty and colSpan is enabled (#432) (4d07eea)
  • table: row doesn't inherit the table settings correctly (#428) (60a781c)

Code Refactoring

  • command: refactor .parseOptions() method (#409) (58df99d)

Chore

Documentation Updates

  • command: update ansi example (#422) (cab4f51)
  • command: fix examples and use local file imports (#410) (4c62043)
deno-cliffy -

Published by c4spar about 2 years ago

Features

  • command: support passing global options before sub-command (#388) (ecbbcc0)
  • command: add support for list type in arguments (#402) (6dd3a6c)
  • command: indicate required env vars in help text (#394) (8f51cca)

Bug Fixes

  • command: all options should be optional if .allowEmpty() is called (#408) (2ba7386)
  • command: negatable option causes parsing issues when positioned before non-negatable options (#400) (751e1aa)
  • command: explicitly scope fish variables in completion script (#397) (2048a1e)
  • command: help text not always shown for validation error (#401) (e7bc0e8)
  • command: error handling not working correctly (#389) (0d66e88)

Code Refactoring

  • command: refactor .parseCommand() method (#404) (60b9dd7)

Chore

Documentation Updates

deno-cliffy -

Published by c4spar over 2 years ago

Bug Fixes

  • command: list type not working in env vars (#379) (9d24d78)

Chore

deno-cliffy -

Published by c4spar over 2 years ago

Features

  • command: allow boolean values in enum type (#377) (1f3d47e)

Bug Fixes

  • command: mapped value not correctly infered in option action handler (#378) (dbde261)

Chore

  • ci: run lint and test workflows on pull requests (#374) (cb2bb7e)
  • ci: disable temporarily the --jobs flag on ci (#376) (235838b)

Documentation Updates

  • correct plural/possessive usage of "'s" (#371) (3964dfe)
  • contributing: update test command to run successfully (#373) (#375) (23d5436)
deno-cliffy -

Published by c4spar over 2 years ago

BREAKING CHANGES

  • 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

Features

  • flags: add equalsSing option (#368) (eb75c0a)

Bug Fixes

  • command,flags: fix handling of multi option arguments (#368) (eb75c0a)
deno-cliffy -

Published by c4spar over 2 years ago

v0.23.2 (Apr 29, 2022)

Features

  • command: dedent description for better multiline support (#365) (87976a6)
  • command: add support for grouped options (#364) (9d00c61)

Chore

Unit/Integration Tests

  • command: use assertSnapshot for integration tests (#367) (2dc7872)
deno-cliffy -

Published by c4spar over 2 years ago

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

deno-cliffy -

Published by c4spar over 2 years ago

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 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.

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 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)

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