Skip to content

Inconsistent handling of enum raw values on the command line #771

Open
@rgoldberg

Description

@rgoldberg

There seems to be inconsistent handling of enum raw values on the command line.

The following code is from CompletionScriptTests.swift:

enum Kind: String, ExpressibleByArgument, EnumerableFlag {
    case one, two
    case three = "custom-three"
}

@Flag var allowedKinds: [Kind] = []
@Option() var kind: Kind

case three = "custom-three" from above is considered as --three for a flag
from allowedKinds, but as custom-three as an option value for --kind.

This is the case in the 1.5.0 & main completion scripts, in ToolInfoV0 & even in SAP's
command-line argument verification. It seems to me that it should be consistent
throughout; of the 2 options, custom-three seems more sensible.

ArgumentParser version: main
Swift version:
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0

Checklist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions