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

Support options being used multiple times #85

Closed
Ponyboy47 opened this issue Sep 13, 2018 · 2 comments
Closed

Support options being used multiple times #85

Ponyboy47 opened this issue Sep 13, 2018 · 2 comments
Projects

Comments

@Ponyboy47
Copy link
Contributor

Ponyboy47 commented Sep 13, 2018

Basically, conditionally conform Array to FlagValue:

extension Array: FlagValue where Element: FlagValue {
    // Implementation...
}

Allow array types to be specified multiple times on the command line, where each time it's specified you just append the item to the array.

This is a pretty common feature used by some video converting tools (ffmpeg, handbrake, etc).

ie: transcode_video supports multiple 'target' options, some for file/encoding size and others for encoding speed. So this is a perfectly valid command:
transcode-video --target big --target quick --output /path/to/output /path/to/file

The --target big option will perform a higher quality encoding, resulting in a larger file size and slower encode. The --target quick option performs other optimizations that speed up the encoding without noticeably reducing the quality and only increasing the file size by a small amount.

@Ponyboy47
Copy link
Contributor Author

I've forked this and begun trying to implement it myself and it is a bit more complex than I'd hoped because of the current design. I'll see if I can't figure it out without changing too much, but we'll see how plausible this really is.

I could easily make Array conform to FlagValue and just split results on a comma or some designated separator, but then you could run into issues where your whole input string and its individual values may both contain the separator character and you've got to figure out how to distinguish between them. So I'd rather have the more familiar usage of just specify an argument multiple times to avoid this kind of complexity.

@thii
Copy link
Collaborator

thii commented Sep 13, 2018

@Ponyboy47 Thanks for trying this. I agree that options should be able to be used multiple times, as it follows the POSIX guidelines. Awaiting your PR.

@thii thii added this to Todo in Guaka CLI Sep 13, 2018
@thii thii closed this as completed Sep 15, 2018
@thii thii moved this from Todo to Done in Guaka CLI Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants