On 7 December 2017 at 17:20, dc0d <kaveh.shahbaz...@gmail.com> wrote: > The way it is implemented currently, it supports multiple commands. And it > can be decided by checking the flags against their default values.
That won't work if you don't pass any flags! > Maybe it should return a []string. Any specific suggestions? I'd suggest that only one command can be specified at any one time (all the command line apps that I know work like this). As far as I can see from a brief glance, your package doesn't allow any non-flag arguments to be passed to a subcommand. How about making Parse return the name of the selected subcommand (or the empty string if none is specified) ? BTW as of Go 1.10, you'll be able to avoid the dubious reflect hack to get the name from the FlagSet. > > On Thursday, December 7, 2017 at 7:13:57 PM UTC+3:30, rog wrote: >> >> On 7 December 2017 at 09:52, dc0d <kaveh.sh...@gmail.com> wrote: >> > Coming late, yet I've written a minimal package (which can be even just >> > copied and paste or bundled) that uses only the flag package itself >> > without >> > adding new types, just a single function. >> >> I like the minimalism, but how are you supposed to know which subcommand >> has been chosen? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.