Skip to content

Default value not displayed in help for Flags built from CaseIterable enums #56

@glessard

Description

@glessard

When using flags built from a (String & CaseIterable) enum, such as this:

enum OutputBehaviour: String, CaseIterable { case stats, count, list }

struct Options: ParsableCommand {
  @Flag(name: .short, default: .list, exclusivity: .chooseFirst, help: "Help!")
  var behaviour: OutputBehaviour
}

let options = Options.parseOrExit()

The corresponding line in the help message does not display the default value.

The Flag initializer passes the default value along to the ArgumentDefinition constructor, but when the array of ArgumentDefinition is read back in HelpGenerator, the help.defaultValue properties for these is nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions