kargos icon indicating copy to clipboard operation
kargos copied to clipboard

Overhaul handling of spaces and quotes in arguments

Open shocklateboy92 opened this issue 5 years ago • 3 comments

I've never used BitBar and don't know if I'm breaking compatibility by doing this, but here's how I think arguments should be parsed.

| arg1=value1 arg2=value\ 2 "arg3=value 3" arg4="value 4" and arg5=value" 5" 'arg 6=value 6'

Should all break down into argN=value N, kind of like how a shell would do. (I don't plan to have any keys with spaces in them, but the argument parser shouldn't care).

Gathering some feedback before I take a crack at implementing it.

shocklateboy92 avatar Apr 09 '20 22:04 shocklateboy92

I think that BitBar allows parameters without quotes. https://github.com/matryer/bitbar/blob/master/README.md If there are spaces, it seems that OSX bitbar needs double quotes (see "bash" parameter).

I am not sure about passing the parameter value inside quotes... (it seems somehow strange) "arg3=value 3" and 'arg6=value 6'

lipido avatar Apr 13 '20 05:04 lipido

As far as I can tell, the combination of examples I listed above is a strict superset of the BitBar ones. Hopefully I'll have time to take a crack at implementing a draft soon and we'll see.

As for passing the parameter value inside quotes, I was inspired how a shell splits arguments to a program. I.e.

grep --exclude="some file" ...

and

grep "--exclude=some file" ...

end up getting parsed/normalized to the same thing.

shocklateboy92 avatar Apr 16 '20 09:04 shocklateboy92

Ok, if it is a superset of OSX BitBar, I think that we can go forward.

Given your explanation about shell scripts parameter splitting, you have convinced me (although I never have seen this form!)

lipido avatar Apr 16 '20 09:04 lipido