Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple (variadic) options support? #124

Open
boxsnake opened this issue Mar 5, 2025 · 1 comment
Open

Multiple (variadic) options support? #124

boxsnake opened this issue Mar 5, 2025 · 1 comment

Comments

@boxsnake
Copy link

boxsnake commented Mar 5, 2025

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.

@adhocore
Copy link
Owner

adhocore commented Mar 6, 2025

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants