Permalink
Browse files

add hub commands to `hub help --all`

While exploring the bash-based completion script for zsh, I initially
implemented this so that the bash script would see the new commands.
Obviously this didn't work because the completion script invokes the
real `git` command, not `hub`.  But I think the feature is nice for
users.
  • Loading branch information...
1 parent 563209d commit 1b312545ac012efbb7afc29a1e893139b4346557 @goodell goodell committed Mar 4, 2013
Showing with 12 additions and 4 deletions.
  1. +12 −4 lib/hub/commands.rb
View
16 lib/hub/commands.rb
@@ -709,10 +709,18 @@ def help(args)
if command == 'hub'
puts hub_manpage
exit
- elsif command.nil? && !args.has_flag?('-a', '--all')
- ENV['GIT_PAGER'] = '' unless args.has_flag?('-p', '--paginate') # Use `cat`.
- puts improved_help_text
- exit
+ elsif command.nil?
+ if args.has_flag?('-a', '--all')
+ # Add the special hub commands to the end of "git help -a" output.
+ args.after 'echo', ['']
+ args.after 'echo', ['hub commands']
+ args.after 'echo', ['']
+ args.after 'echo', [' ' + CUSTOM_COMMANDS.join(' ')]
+ else
+ ENV['GIT_PAGER'] = '' unless args.has_flag?('-p', '--paginate') # Use `cat`.
+ puts improved_help_text
+ exit
+ end
end
end
alias_method "--help", :help

0 comments on commit 1b31254

Please sign in to comment.