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

Add support for multi occurrence options #45

Open
ajafff opened this issue Apr 25, 2018 · 0 comments
Open

Add support for multi occurrence options #45

ajafff opened this issue Apr 25, 2018 · 0 comments

Comments

@ajafff
Copy link

ajafff commented Apr 25, 2018

While trying to port hand-written argument parser, I noticed that there's currently no way to configure an option that may occur multiple times and accumulates the arguments:

grep -e 'foo' -e 'bar'

This is how I'd like this to work:

export class GrepOptions extends Options {
  @param({multi: true}) public e: string[];
}

@command()
export default class extends Command {
  @metadata
  public execute(options: GrepOptions) {
    console.log(options.e); // ['foo', 'bar']
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants