Skip to content

Multiple (variadic) options support? #124

Description

@boxsnake

Good project.

I am wondering if there is anyway to implement something like variadic in options rather than arguments?

Such as:

php foo.php --bar 1 --bar 2

which gives:

Array (
  [bar] => Array(
    [0] => 1,
    [1] => 2,
  )
)

Thanks.

Activity

  1. adhocore commented on Mar 6, 2025

    @adhocore
    Owner

    yes it's possible to define variadic like so

    $command->option('-b|--bar [...]', 'Bar can be passed more than once');
    // ... represents variadic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions