-
Notifications
You must be signed in to change notification settings - Fork 3
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
Any better strategy for escaping commas? #7
Comments
Hello, @treykeown. It seems that you are having trouble escaping a character. Usually, commas do not need to be escaped to be recognized, so I guess that your problem is escaping the double quotes character am I right? If that is the problem, one easy solution is to wrap your argument around single quotes, like this: ./script.py cmd 'first,"second,also-second",third' |
Hi, thanks for the input! Good point, I'll probably recommend this approach in the docs. Escaping commas is the key here, though. I'm hoping for some inspiration on how other projects do it, but the only example I've found is here in
This approach is not appropriate for |
After taking a look in some examples in the Qemu manual you linked, I think that I understand now what you want to do: you are having trouble parsing commands like this:
Where there is, for example, a I guess one easier solution than quoting it, is to prefer receiving the arguments using flags, so that same command would become:
Considering that both flags, |
Hey, thanks for taking a look. This isn't about splitting up arguments, it's about escaping a comma. |
@treykeown, are you able to provide a bit more context for this? What is the specific use case that you want to support? From the thread so far, it is not terribly clear as to why this is not about splitting arguments. If it is not about splitting arguments, does that mean that the input I'm asking for this clarity because, as far as I can decipher at this point, if it is not about splitting arguments, then it appears that perhaps this in not something that you as the author should be concerned with. In other words, if an However, if that's not the case, then it seems that more context from you would better enable us to provide meaningful input to you. |
Ah, I see where this is coming from: https://treykeown.github.io/arguably/tutorial/type-hints/#tuples That seems to be a rather obscure use case. Do you have a good example of why someone might want to do this? Wouldn't it be easier to simply define separate args/options? |
@chuckwondo Coming back to this with fresh eyes, I believe you're right. I'm not sure there's any reason to put more effort into this. Closing. |
Is there any better way to do this? Right now, on the command prompt, you have to escape your quotes when trying to escape a comma. A little clunk to type
./script.py cmd first,\"second,also-second\",third
.The text was updated successfully, but these errors were encountered: