You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to use command line style options for a function which is to be called from other functions. Here the entire command will be passed as a single string(not a vector of strings as i see in most of the examples here). Is there a way for me to utilize the args library to extract the options out of that command? Here, some of the options could include quoted filenames with spaces in-between, so a simple space based partition of the original string is too simplistic to work.
The text was updated successfully, but these errors were encountered:
That's out of the scope of this library, unfortunately. If I were to write up an interface for properly splitting up such a formatted string into an array of arguments with string escaping and all, I'd be inclined to package that as a separate library, rather than packaging it in this one anyway.
You could write such a parser simply enough. If your needs are very simple (ie. no need for escapes of any sort, including escaped quotes inside of quoted strings), you could split on your wanted quote character, then split the even parts by whitespace to get your argument list. If your needs are more complex, you're probably better off with a real parser. A naive character-by-character parser would likely be sufficient.
Hi,
I am trying to use command line style options for a function which is to be called from other functions. Here the entire command will be passed as a single string(not a vector of strings as i see in most of the examples here). Is there a way for me to utilize the args library to extract the options out of that command? Here, some of the options could include quoted filenames with spaces in-between, so a simple space based partition of the original string is too simplistic to work.
The text was updated successfully, but these errors were encountered: