3 ms·
Their example here confuse me: https://github.com/celicoo/docli/blob/master/examples/terraform/main.go https://github.com/celicoo/docli/blob/master/examples/te
by pushpop 8y ago
Their example here confuse me:
https://github.com/celicoo/docli/blob/master/examples/terraform/main.go https://github.com/celicoo/docli/blob/master/examples/terraf...
`workspace` isn't a boolean flag. So it isn't clear from that example how - or even if - docli can work with more complex conditional arguments.
Is someone with any familiarity with this project able to advise how you'd handle that in docli?
- granra 8y agoAll the variables in in the `Commands` and `AllOtherCommands` are bools. In Go you can do `a, b, c bool` and they'll all be of type bool.
- pushpop 8y agoYeah I got that. My point is that ‘workspace’ isn’t a Boolean flag in terraform. It requires additional flags to function, eg terraform workspace new granra ‘workspace’ is effectively the CLI flags equivalent of a submenu.
- granra 8y agoOh I see. It looks like docli sets the flag as true if it was passed as a parameter to the program. So you do: var terraform Terraform args.Bind(&terraform) if terraform.Workspace { // do workspace stuff } I think. EDIT: I don't know how hackernews formatting works :/
- pushpop 8y agoThat seems really messy to be honest because you can’t then ensure flags are nested correctly. I guess for simple purposes this is fine though.