Options in variadic arguments
See original GitHub issueIn my particular use case I’d need to accept a variable number of cli arguments (including options) unrelated to cliffy after a series of valid args, for example:
mycmd --myoption mysubcmd myarg other args and --options
|
cliffy args <-|-> other args
To do this I’ve been using a variadic argument in mysubcmd
new Command()
.command('mysubcmd [myarg] [otherArgs...]');
but I didn’t take into account that --options
could break it
[ERROR:...] Unknown option --options
Do you have any suggestions on how to accomplish this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Variadic arguments - cppreference.com
When a variadic function is called, after lvalue-to-rvalue, array-to-pointer, and function-to-pointer conversions, each argument that is a part of the variable ...
Read more >Ultimate Guide to Go Variadic Functions | by Inanc Gumus
Accepting variable types of arguments. For example, Go Stdlib's Printf variadic func accepts any type of input params by using an empty interface...
Read more >Variadic function - Wikipedia
In mathematics and in computer programming, a variadic function is a function of indefinite arity, i.e., one which accepts a variable number of...
Read more >How To Use Variadic Functions in Go - DigitalOcean
A variadic function is a function that accepts zero, one, or more values as a single argument. While variadic functions are not the...
Read more >Modern C++ and Variadic Functions: How to Shoot Yourself in ...
It is possible to declare function with a variable number of arguments, i.e. the number of function arguments can be greater than the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @umbopepato,
in v0.9.0 is now a new way to resolve your issue. You can use .stopEarly() instead of
.useRawArgs()
. IfstopEarly
is enabled, all arguments, starting from the first non option argument, will be interpreted as raw argument. In contrast to.useRawArgs()
the--help
and--version
option will still work.Awesome! Thank you @c4spar