All Versions
10
Latest Version
Avg Release Cycle
110 days
Latest Release
214 days ago

Changelog History

  • v0.17.0

    October 24, 2019

    πŸš€ As the releases before, this release has 100% test coverage.

    πŸš€ This release keeps on the work of removing the kinks around subcommands.
    An example showing subcommands can be found in ./examples/mygit.

    🚦 It also introduces the use of context to propagate cancelation signals, etc. to the child commands.

    Finally, it introduces a new helper that captures interrupts (for example Ctrl-C) and returns a top level context.

    πŸ’₯ Breaking changes

    ♻️ Refactor NewCommmand as a method.
    This will allow the built-in help to have information about the parent.
    It might also help with autocompletion.

    πŸ”„ Change sigature to opt.NewCommand(name, description string).
    It takes a name and description now.

    πŸ”„ Change signature of CommandFn to have a context as the first argument.
    🚦 It will allow the parent to propagate cancelation signals, etc. to the child commands.
    This change goes along a change to the helper opt.Dispatch to also have a context as the first argument.

    ⚑️ Updating:

    - list := getoptions.NewCommand().Self("list", "list instances").+ list := opt.NewCommand("list", "list instances"). SetOption(parent.Option("help"), parent.Option("debug")). SetCommandFn(runInstanceList) list.StringSlice("tag", 1, 99, opt.Alias("t"), opt.Description("Any AWS tags you want to list"))- opt.Command(list) ...- err = opt.Dispatch("help", remaining)+ err = opt.Dispatch(context.Background(), "help", remaining) ...-func runInstanceList(opt \*getoptions.GetOpt, args []string) error {+func runInstanceList(ctx context.Context, opt \*getoptions.GetOpt, args []string) error {
    

    πŸ†• New Features

    • 🚦 Introduce opt.InterruptContext(), a helper that returns a top level context that captures interrupt signals (os.Interrupt, syscall.SIGHUP, syscall.SIGTERM).
      An example can be found in ./examples/mygit.
  • v0.16.0

    September 24, 2019

    πŸš€ As the releases before, this release has 100% test coverage.

    πŸ›  Fixes

    • πŸ› Bug Fix: Update opt.Dispatch not to handle --help option.
      It was preventing the help option to reach the commands.

    πŸ†• New Features

    • 0️⃣ Introduce opt.HelpSynopsisArgs(string) method to allow overriding the default args description.
      0️⃣ The current default description is [<args>].

    Minor changes

    • πŸ‘‰ Make SetMode, SetUnknownMode, SetRequireOrder and SetMapKeysToLower chainable.
  • v0.15.0

    August 30, 2019

    πŸš€ As the releases before, this release has 100% test coverage.

    πŸ”„ Change workflow to deal with ambiguities between parent and child.

    For example, the root may have option --profile and the command the option --password with alias -p. If -p is passed, the parent would uncorrectly be matched.

    For the parent to properly handle ambiguities with its children, it needs to have knowledge of them. A new getoptions.NewCommand has been introduced.

    To help with the verbosity of handling all the commands, a new Dispatch method is introduced, it will call a command's function defined with the new SetCommandFn method.

    πŸ†• New Features

    β€’ Introduce getoptions.NewCommand() to declare commands and clearly separate their role from the main getoptions.New().

    β€’ Introduce command.SetCommandFn(fn CommandFn) to declare a commands function callback.

    β€’ Introduce opt.Dispatch(helpOptionName string, args []string) to automatically handle dispatching to the CommandFn based on the cli input.

    β€’ Make options unambiguous with commands.
    For example, the root may have option --profile and the command the option --password with alias -p. If -p is passed, the parent would uncorrectly be matched.

    β€’ Introduce new error indicating which options are getting matched with ambiguous options.

    β€’ Add getoptions.HelpCommand() to have an automated help command.
    It adds completions for all other commands automatically.

    Minor changes

    ⚠ β€’ Fix unknown option warning formatting.
    ⚠ Each warning has its own line and it is preceded by WARNING:.

    πŸ“š β€’ Minor README updates... New features need proper documentation.

    β€’ Minor automated help changes.

  • v0.14.1

    July 28, 2019

    Bypass double dot golang modules error:
    golang/go#27299

  • v0.14.0

    July 28, 2019

    πŸš€ As the releases before, this release has 100% test coverage.

    πŸš€ This release introduces bash completion by default and works out many kinks around subcommands.
    An example showing subcommands can be found in ./examples/mygit.

    πŸ’₯ Breaking changes

    🚚 β€’ Remove support for Go < v1.10 (v1.5 - v1.9).

    β€’ Rename getoptions.Option to getoptions.Value.
    ⚠ WARNING: A new getoptions.Option method is has been introduced, but the new one returns *option.Option instead.

    β€’ Change the argument of opt.SetMode and opt.SetUnknownMode from a string to a getoptions.Mode and getoptions.UnknownMode type.
    πŸ‘‰ Makes it easier to autodiscover valid arguments for the method.

    ♻️ β€’ Refactor section help methods into the main opt.Help one.

    - opt.HelpName()+ opt.Help(getoptions.HelpName)- opt.HelpSynopsis()+ opt.Help(getoptions.HelpSynopsis)- opt.HelpCommandList()+ opt.Help(getoptions.HelpCommandList)- opt.HelpOptionList()+ opt.Help(getoptions.HelpOptionList)
    

    πŸ–¨ To print all the sections of the automated help, continue to use opt.Help().

    πŸ†• New Features

    0️⃣ β€’ Implement bash completion by default.

    βž• Add the following to your .bashrc:
    0️⃣ complete -o default -C "/binary/location/myscript" myscript

    β€’ New getoptions.Option method that returns *option.Option.
    In combination with the new getoptions.SetOption it allows to pass options from parent to subcommand.

    β€’ Add getoptions.CustomCompletion method.
    Given a list, it will add the elements of the list to the completion alternatives.

    β€’ Add getoptions.StringMapVar method.

    Minor changes

    β€’ Pad SYNOPSIS content with 4 spaces.
    β€’ Add Self method to populate help NAME section.

    Backend changes

    ♻️ β€’ Refactor the code into more modular pieces.

  • v0.13.0

    March 02, 2019

    πŸš€ As the releases before, this release has 100% test coverage.

    πŸ†• New Features

    • Experimental implementation of help messages.
    • πŸ‘‰ Show used alias in errors for single options (not slice or maps).
    • βž• Add opt.CalledAs method to know how the option was called.

    Minor changes

    • βž• Add example script.
    • βž• Add golang 1.12 to test suite.
  • v0.12.0

    February 19, 2019

    πŸš€ As the releases before, this release has 100% test coverage.

    πŸ’₯ Breaking change: Update function signatures

    πŸ”„ Change all function signatures from:

    XVar(p *bool, name string, def bool, aliases ...string)

    To:

    XVar(p *bool, name string, def bool, fns ...ModifyFn)

    This change allows to pass different functions to the option that will
    modify single option behaviour and will allow for multiple features
    without future breaking changes in the function signature.

    πŸ‘ As part as this change, a new function, opt.Alias is added to support
    previous functionality.

    ⚑️ To update, change the aliases from a list of aliases as the variadic
    last argument to a list of aliases passed to the opt.Alias function.
    For example:

    - opt.BoolVar(&flag, "flag", false, "f", "alias2")+ opt.BoolVar(&flag, "flag", false, opt.Alias("f", "alias2"))
    

    πŸ†• New Features

    • βž• Add opt.Alias option modifier to assign option aliases.
    • βž• Add opt.Required option modifier to indicate if an option is required.
  • v0.11.0

    August 16, 2017

    πŸš€ As the releases before, this release has 100% test coverage.

    πŸ›  Fix go tip case sensitive import path:

    • davidgamba -> DavidGamba

    πŸ—„ Deprecate and rename redundant methods:

    StringSlice is redundant with StringSliceMulti.
    Calling:
    StringSlice(name, aliases...)
    Is the same as Calling:
    StringSliceMulti(name, 1, 1, aliases...)
    Consolidate API to:
    StringSlice(name, min, max, aliases...)

    StringMap is redundant with StringMapMulti.
    Calling:
    StringMap(name, aliases...)
    Is the same as Calling:
    StringMapMulti(name, 1, 1, aliases...)
    Consolidate API to:
    StringMap(name, min, max, aliases...)

    πŸ“‡ Rename IntSliceMulti to IntSlice.

    πŸ†• New features:

    βž• Add StringSliceVar and IntSliceVar methods.

    βž• Add option to SetMapKeysToLower.

  • v0.10.0

    March 22, 2017
  • v0.9.0

    February 04, 2017