Permalink
Browse files

README.rdoc updated list_actions

  • Loading branch information...
1 parent 8af62a1 commit 101c095dfa5ace6961ed4c6702e46b7dfb241008 @rkumar committed Oct 6, 2011
Showing with 19 additions and 0 deletions.
  1. +19 −0 README.rdoc
View
19 README.rdoc
@@ -72,6 +72,25 @@ Assuming a program "prog" with subcommands "del" and "add"
selected_command_name = opt_parse()
+== Custom Completion
+ The command list_actions can be called from your application, so that the user
+ can have custom completion.
+
+ opts.on("--list-actions", "list actions for autocompletion ") do |v|
+ Subcommands::list_actions
+ exit 0
+ end
+
+ Now we can place something like this in a configuration file. Here's what i placed
+ in .zshrc for bugzyrb.
+
+ _bugzyrb() {
+ reply=(`bugzyrb --list-actions`)
+ }
+ compctl -K _bugzyrb bugzyrb
+
+ Now, on the command line when I type "bugzyrb <TAB>" the actions are prompted in a menu.
+
== Sample Output
$ ruby subcommand.rb help

0 comments on commit 101c095

Please sign in to comment.