go-getoptions v0.18.0 Release Notes

Release Date: 2020-03-25 // about 4 years ago
  • ๐Ÿš€ As the releases before, this release has 100% test coverage.

    ๐Ÿš€ This release adds initial support for Environment Variables and adds lots of GoDoc examples.

    ๐Ÿ†• New Features

    • ๐ŸŽ‰ Initial support for environment variables has been added.

    ๐Ÿ‘ Currently, only opt.String and opt.StringVar are supported.

    To use it, set the option modify function to opt.GetEnv.
    For example:

    var profile stringopt.StringVar(&profile, "profile", "default", opt.GetEnv("AWS\_PROFILE"))
    

    Or:

    profile := opt.String("profile", "default", opt.GetEnv("AWS\_PROFILE"))
    

    ๐Ÿ‘ NOTE: Non supported option types behave with a No-Op when opt.GetEnv is defined.

    Minor changes

    • ๐Ÿ”„ Change opt.Dispatch signature to clarify the actual use of the variable.
      โž• Additionally, actually use the variable, before it was hardcoded to "help".

      -func (gopt *GetOpt) Dispatch(ctx context.Context, helpOptionName string, args []string) error+func (gopt *GetOpt) Dispatch(ctx context.Context, helpCommandName string, args []string) error