-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Is there a way to escape flag input? #1025
Comments
This issue is being marked as stale due to a long period of inactivity |
Is there any update about this issue? |
Found a solution, the user will need to add a "--" to the command |
You may also be interested in the Interspersed option of pflag: https://github.com/spf13/pflag/blob/d5e0c0615acee7028e1e2740a11102313be88de1/flag.go#L1208 |
There's an explanation of the interspersed option in this issue #1307 (comment) |
Sounds like this got resolved. Closing. |
Let's say I have a flag called
app_options
. I want to basically take whatever raw string is provided there and use it to hand to a binary underneath my application.Ergo if the CLI app I'm calling is
do_the_thing
, I want to pass the options fromapp_options
todo_the_thing
.Ie
do_the_thing [app_options]
specifying
--app_options "-maxlim=0"
only yields a value of0
for theapp_options
flag as if the rest of the string had been captured as a flag itself.Is there a way to specify an unescaped or unparsed string such that the above would pass the entirety of
maxlim=0
into the cobra flag?The text was updated successfully, but these errors were encountered: