Releases: DavidGamba/go-getoptions
v0.33.0: New Features
As the releases before, this release has 100% test coverage.
Tested with Go 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22, 1.23 and 1.24.
New Features
- Add
opt.SuggestedValuesFnModifyFn to dynamically set autocompletion suggestions for an option.
v0.32.0: Breaking Changes
As the releases before, this release has 100% test coverage.
Tested with Go 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22, 1.23 and 1.24.
Breaking Changes
- Rename
opt.CustomCompletiontoopt.ArgCompletionsto clarify what this completion is for.
New Features
- add
opt.ArgCompletionsFnswhich allows to provide custom argument completion functions that get lazily called.
The completion functions receive the target shell (bash or zsh), the previous arguments, and the current partial completion.
v0.31.0: Breaking Changes
As the releases before, this release has 100% test coverage.
Tested with Go 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.22 and 1.23.
Breaking Changes
Fix typo in dag library: TaskDependensOn -> TaskDependsOn
New Features
-
Add task retries in dag library.
-
Add logging color support in dag library.
v0.30.0: New Features
As the releases before, this release has 100% test coverage.
Tested with Go 1.16, 1.17, 1.18, 1.19, 1.20, 1.21 and 1.22.
New Features
-
Add
opt.SetValueto allow setting the value of an option. -
Add
opt.SuggestedValuesModifyFn to allow setting autocompletion suggestions for an option.
Works just like the existing opt.ValidValues but it doesn't error out if the value is not in the list of suggestions.
- Add
opt.GetRequiredArg,opt.GetRequiredArgIntandopt.GetRequiredArgFloat64to simplify handling required arguments and providing error messages.
For example:
opt := getoptions.New()
opt.SetCommandFn(Run)
opt.HelpSynopsisArg("<arg1>", "arg1 desc")
opt.HelpSynopsisArg("<arg2>", "arg2 desc")
...
func Run(ctx context.Context, opt *getoptions.GetOpt, args []string) error {
i, args, err := opt.GetRequiredArgInt(args)
if err != nil {
return err
}
...
return nil
}If the argument is not provided, the error message will be:
ERROR: Missing required argument: <arg1>
If the argument is provided but it is not an integer, the error message will be:
ERROR: Argument error: Can't convert string to int: 'x'
v0.29.0: New Features
As the releases before, this release has 100% test coverage.
Tested with Go 1.16, 1.17, 1.18, 1.19, 1.20 and 1.21.
New Features
- Add
opt.SetCalledModifyFn to allow setting an option as called.
Useful when calling CommandFn directly and not through opt.Dispatch and without a call to opt.Parse.
It allows building a opt object using defaults and marking the options as called.
For example:
func Run(ctx context.Context, opt *getoptions.GetOpt, args []string) error {
password := opt.Value("password").(string)
nopt := getoptions.New()
nopt.String("password", password, opt.SetCalled(opt.Called("password")))
nopt.Int("number", 123, opt.SetCalled(true))
nopt.Float64("float", 3.14) // opt.Called("float") is false but its value is set to 3.14
err := CommandFn(ctx, nopt, []string{})v0.28.0: Extend ZSHELL support
v0.28.0: Extend ZSHELL support
As the releases before, this release has 100% test coverage.
Tested with 1.16, 1.17, 1.18, 1.19, 1.20 and 1.21.
Breaking
Dropping support for Go 1.14 and 1.15 to stop using deprecated io/ioutil.
New Features
- Extend support for ZSHELL when setting
ZSHELL=truein your environment.
ZSHELL completion works by using bashcompinit using:
autoload bashcompinit
bashcompinit
complete -o default -C <tool> <tool>
Before this release, completions would stop after the = symbol because the completion system is targeting bash by default and bash handles = as a divider for completions.
By setting ZSHELL=true in your environment, the completion system will target zsh and not split completions on =.
NOTE: I couldn't find a non-explicit reliable way to auto-detect zsh.
Release v0.27.0
As the releases before, this release has 100% test coverage.
Tested with Go 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20.
Breaking
Refactor and rename HelpSynopsisArgs
- Rename and allow description:
- opt.HelpSynopsisArgs("name")
+ opt.HelpSynopsisArg("name", "description")-
Allow it to be called multiple times.
-
Add ARGUMENTS section in help.
Minor
- dag: Add extra context in log output.
Add graph name in log entries.
Helpful when using more than one graph (graph of graphs).
- Fix lonesome dash in help and in completion results.
v0.26.0: New ErrorParsing and minor fixes
As the releases before, this release has 100% test coverage.
Tested with Go 1.14, 1.15, 1.16, 1.17, 1.18 and 1.19.
- Expose ErrorParsing as a generic error
The ErrorParsing error indicates there was a problem parsing the cli args.
This can be used for example, to print the help only in cases where the user didn't enter valid cli args.
-
Refactor dag package tests to remove most sleeps.
-
Bug fix: Don't check for required options when the help option is passed
v0.25.3: Minor Fixes
As the releases before, this release has 100% test coverage.
Tested with Go 1.14, 1.15, 1.16 and Go 1.17.
Fixes
- When using
opt.Self, if name is empty, usefilepath.Base(os.Args[0]).
v0.25.2: Minor Fixes
As the releases before, this release has 100% test coverage.
Tested with Go 1.14, 1.15, 1.16 and Go 1.17.
Fixes
- Fix bug when running in
SingleDashmode, if calling a single letter option with a single dash, and the option expects a value and the value wasn't provided with=or as a bundle then the option value wouldn't get registered.