Closed zeroXten closed 9 years ago
Had to update the example failure. What I provided originally was broken for other reasons but wasn't the only test I had run.
Is this still a failure under fraser-scott branch? If yes, we can merge to master
fscott-cli branch is working, but I had to change the way I structured the opts. One thing that might make sense, if it is possible, is to have the opts parsing split across the levels. So top level commands like
pki.io ca
pki.io admin
pki.io org
etc. are handled in the main file, then opts specific to those commands are parsed in the relevant functions. E.g. runCA(...) would parse
pki.io ca new
pki.io ca update
etc.
Implementation should be modelled on this https://github.com/docopt/docopt.go/blob/master/examples/git/git.go
So, top level usage and parsing, and per-command usage and parsing.
Stealing this as I'm trying to work out the CLI UX anyway.
Havent looked at the existing code, but the flags package might be useful here.
On Fri, Jan 23, 2015, 12:18 PM Fraser Scott notifications@github.com wrote:
Stealing this as I'm trying to work out the CLI UX anyway.
— Reply to this email directly or view it on GitHub https://github.com/pki-io/admin/issues/1#issuecomment-71258486.
Hi Jon, early in the project we decided to use a 3rd party library for command line parsing - you can see details in the gomfile
Ah okay, that makes sense. I actually haven't looked at clarg parsing libs yet for golang. I'll have to check them out.
On Fri Jan 23 2015 at 12:26:17 PM Athanasios Kostopoulos < notifications@github.com> wrote:
Hi Jon, early in the project we decided to use a 3rd party library for command line parsing
— Reply to this email directly or view it on GitHub https://github.com/pki-io/admin/issues/1#issuecomment-71259696.
I think this is done now. Multi level docopt seems to work nicely.
I added the following line to the usage under "Examples":
Then, when running I just got the generic usage:
Running this worked:
In order to get this working I had to reformat the usage a bit:
But that meant not using a subcommand function:
Here is the output...