Skip to content

Allow a command to accept multiple distinct arguments #310

@tmds

Description

@tmds

Some commands take multiple distinct arguments:

git remote add [<options>] <name> <url>
ln <target> <link_name>

This is typically used for required parameters.
The user doesn't have to specify the name when providing these values.

System.CommandLine currently only supports a single argument.
This argument may be of arity 1+.
The above UX is not possible.

That single argument is made available as a string[].
This is different from Options, where options are bound based on their name to handler argument parameters (related #297). This makes it much less convenient to consume these arguments, than it is to consume Options.

Suggested feature:

  • Support multiple arguments per command
    • Commands with have subcommands can have at most 1 arguments
    • Only the last argument can have arity > 1
    • Only the last argument can be optional
      ~ or relaxed version: If an argument is optional, all arguments succeeding must also be optional
  • Support naming arguments for handler binding (cfr Options)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions