Replies: 1 comment 2 replies
-
It's hard to say without knowing what you've tried, but you want branching positional arguments, then to access the value you can inject the struct into your |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am trying to achieve a cli interface like this:
app foo 123
app foo 123 bar
app foo 123 bar baz
app foo 123 bar fuu 234
In this structure the
app foo 123
would reference a foo object with id 123. The commandapp foo 123 bar
would execute the bar command for the foo object with id 123 etc.app foo 123 bar baz
would then again be a nested optional subcommand under bar. All theese nested subcommands would need access to the id of foo, eg. the commandapp foo 123 bar fuu 234
fuu would need both arguments to function properly.I know i could structure my cli interface another way, but I like the idea of having the arguments next to the command it relates to.
I could probably also get away with using flags for the id's but I prefer using flags to modify behaviour instead of requiring them to operate properly.
A real world example could be something like:
app user 123 search mac aa:bb:cc:dd:ee:ff
Here the app would search for a mac address for a given user, the user might be in a given organisation and would then have to search only that organisations devices etc.
This might just be a skill issue on my part, but I can't seem to make kong behave this way? Is it me not entirely understanding how to structure the cmd interface or is this not possible?
Beta Was this translation helpful? Give feedback.
All reactions