Skip to content

v0.7.0

Latest

Choose a tag to compare

@mfridman mfridman released this 14 May 20:52
d101639

Docs: https://pressly.github.io/cli

See #19 for more context on the API changes in this release.

More breaking changes in one release than I'd prefer. Each one fixed something that had been bugging me, especially the usage and error composition. I expect the API to settle from here.

Added

  • flagtype.EnumDefault constructor for enums with an initial default value
  • Cmd field on State exposing the terminal command selected during parsing
  • Summary field on Command for the short text shown in command lists
  • UsageErrorf for opt-in usage errors; Run prints command help to stderr before returning the
    underlying error

Changed

  • BREAKING: Replace Command.UsageFunc with Command.Help, which returns the full help string
    for a command
  • BREAKING: Replace Command.ShortHelp with Command.Summary for command lists and
    Command.Description for longer command help text
  • BREAKING: Rename FlagOption to FlagConfig and Command.FlagOptions to
    Command.FlagConfigs
  • Commands with subcommands and no Exec now report a usage error when no child command is
    selected, before enforcing required flags inherited by child commands

Removed

  • BREAKING: Remove ErrHelp; check errors.Is(err, flag.ErrHelp) when handling Parse
    directly
  • BREAKING: Remove DefaultUsage and the top-level Usage function from the public API

Full Changelog: v0.6.0...v0.7.0