lipido / kargos

KDE Plasma port of GNOME Argos and OSX BitBar
GNU General Public License v3.0
126 stars 13 forks source link

Overhaul handling of spaces and quotes in arguments #30

Open shocklateboy92 opened 4 years ago

shocklateboy92 commented 4 years ago

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.

lipido commented 4 years ago

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'

shocklateboy92 commented 4 years ago

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.

lipido commented 4 years ago

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!)