Argv provides a commandline argument parser using a subcommand approach where users can layer subcommands
as single line calls. Be aware that the position of the flags (i.e those with --
or -
prefix) matters.
go get -u github.com/gokit/cmdkit
$ ./example --rack=20 --dirs=[drum flag kick] push [email protected]/fla.git
Produces a argv.Argv
, if marshalled in json:
{
"Name": "example",
"Sub": {
"Name": "push",
"Sub": null,
"Text": "[email protected]/fla.git",
"Flags": null,
"Pairs": {}
},
"Text": "push [email protected]/fla.git",
"Flags": null,
"Pairs": {
"dirs": [
"drum",
"flag",
"kick"
],
"rack": [
"20"
]
}
}