How To Format Command Line Argument Key Value Pairs -
a typical format command line arguments is:
myapp --myarg=myvalue
what if want pass in set of key value pairs through command line? like:
myapp --mylist={arg1=val1;arg2=val2;arg3=val3...}
since there seems no standard sort of thing, can provide examples well-used utilities have sort of command line argument input? poked around man pages didn't find any.
edit: i'm wondering both how input should formatted , text might like.
i think largely depends on how parse arguments in program.
here examples programs accept multiple key-value pair values.
man php:
--define foo[=bar] -d foo[=bar] define ini entry foo value bar
man git:
-c <name>=<value> pass configuration parameter command. value given override values configuration files. <name> expected in same format listed git config (subkeys separated dots).
for both, 1 can pass multiple -d
or -c
arguments programs gives ability supply list of key-value pairs programs.
imo, it's not big problem having own style of accepting lists of key-value pairs program long works , well-documented. :)
p.s.: think question more appropriate placed on programmers stack exchange rather on so. see here , here.
Comments
Post a Comment