Skip to content

ExpressibleByArgument, CaseIterable for enum not listing options during failure #344

@BadPirate

Description

@BadPirate

When using ExpressibleByArgument for an enum @option, neither help nor error message correctly shows available options.

ArgumentParser: main
Swift version: Apple Swift version 5.3.1

Checklist

  • If possible, I've reproduced the issue using the main branch of this package
  • I've searched for existing GitHub issues

Steps to Reproduce

Create an option:

    enum Config : String, ExpressibleByArgument, CaseIterable
    {
        case ios, mac, simulator
    }
    
    @Option(help: "Build configuration")
    var config : [Config] = [.ios]

See command help screen using -h, or use the config option with an illegal value:

cli command --config invalid

Expected behavior

  1. Help should show options available
  2. Error message should show valid options

Actual behavior

  1. Help Provides no options.
  2. Error provides no useful options:
Error: The value 'invalid' is invalid for '--config <config>'
Usage: cli command [--config <config> ...] 
  See 'cli command --help' for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions