I asked this several months ago, and sadly there didn't seem to be anything. I ended up writing something that I am more than happy to share, it doesn't support commands but does support delegates. It's not a quite stand alone utility, but is part of a set of utilities I use to generate a manual, and better usage screen from JCommander, etc. You'd probably have to tinker with it a bit, and I'm not a bash expert. I've attached an example of what gets automatically generated. Most of the specific options are enum's or custom 'sets'. I have modified JCommander to require boolean arguments be passed true or false, so it auto completes true or false with booleans. It 'should' work with an arbitrary object, annotated correctly.
Anyway if you'd find it helpful I don't mind packaging it up seperately.
Steve
--
You received this message because you are subscribed to the Google Groups "jcommander" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
<bash_autocomplete.sh>
Here you go,
Attached is a packaged jar with source and compiled version. I didn't remove all the manual generation code, but did make an example. You run the ca.ubc.cs.beta.aclib.misc.bashcompletion.BashCompletion class, supplying the name of the class, the name of the command, and the name of the output file. You can also set debug to true, to see the output. I included a dummy example which you can run as follows:
java ... ca.ubc.cs.beta.aclib.misc.bashcompletion.BashCompletion --class ca.ubc.cs.beta.aclib.example.ExampleOptions --commandName joker --outputFile /tmp/bashcompletion.sh --debug
It will will write the following to the output file: