Alexey Serbin has posted comments on this change.

Change subject: tool: better handling for positional arguments

Patch Set 1:

 > > Sure wish there was some test coverage on these tools...
 > Alright, you got me. I'll add some in another patch.
 > > There is a Go library which allows to implement rich CLI tools. 
 > If
 > > using the library it's really easy to document the
 > > commands/sub-commands/parameters and it provides tab-completion
 > > support for shell as an additional feature.  It might be useful
 > to
 > > take a look at that:
 > >
 > >
 > >
 > > There is even more powerful library named Cobra:
 > >
 > >
 > > We implemented very decent command-line tool using
 > codegangsta/cli
 > > library in one of prior projects.
 > >
 > > Also, if talking about command-line tools: given the abundance of
 > > CLI libraries, it might make sense to consider an option to
 > > implement those in Go.  It's really fast and simple in
 > development
 > > and seems to be the perfect language choice for that sort of
 > > things.
 > Thanks for pointing me at those. I took a quick look at cli, and
 > it's encouraging to see that it uses largely the same patterns that
 > this tool does: actions nested under verbs, each of which is mapped
 > to a function.
 > As for writing the tool in Go, Dan asked me the same question (but
 > about Python). I wanted to use C++ because I wanted to avoid
 > introducing a runtime dependency (this is mostly a knock against
 > Python, since Go programs are statically linked), and I wanted to
 > make it super easy to call into our existing C++ code.
 > > Also, if it makes sense to exercise bash completion to in
 > > displaying available sub-commands, it would also make sense to
 > > check that.  Basically, it's about outputting the available
 > > sub-commands if given --enable-bash-completion option at any
 > level.
 > Didn't know this. Am I understanding you correctly: if a program
 > responds to --enable-bash-completion with a list of verbs, then
 > bash will invoke that behind the user's back when they try to tab
 > complete? That is, if I run "kudu <TAB>", bash will try to run
 > "kudu --enable-bash-completion" to figure out what the possible
 > completions are?

Yes, that's the idea.  The bash can use different option.  Actually, an 
additional .bashrc customization will be necessary.  For details, please take 

To view, visit
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic6aa517ccf1915e4d106bcc5f80a3abfeae03271
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Adar Dembo <>
Gerrit-Reviewer: Adar Dembo <>
Gerrit-Reviewer: Alexey Serbin <>
Gerrit-Reviewer: Dan Burkert <>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Todd Lipcon <>
Gerrit-HasComments: No

Reply via email to