summaryrefslogtreecommitdiff
path: root/exe
diff options
context:
space:
mode:
authorJames Wen <jrw2175@columbia.edu>2015-12-21 12:41:03 -0500
committerJames Wen <jrw2175@columbia.edu>2015-12-21 13:58:48 -0500
commit543eaf6226fcdb494c095893b6f73268bd5f16f8 (patch)
treef78ee31cc2ebf1f63728580541d4338407acbcbd /exe
parent108c356f913f1284729346d0037a6028e540c0c9 (diff)
downloadbundler-543eaf6226fcdb494c095893b6f73268bd5f16f8.tar.gz
Redirects any usage of --help or -h flag for a command to that command's help
- Any usage of `--help` or `-h` as a flag, whether it's before or after the command, will now pull up the help for that command. The following are all equivalent: ``` bundle help install bundle install --help bundle install -h bundle --help install bundle -h install ```
Diffstat (limited to 'exe')
-rwxr-xr-xexe/bundle8
1 files changed, 7 insertions, 1 deletions
diff --git a/exe/bundle b/exe/bundle
index 5baa52235a..a6068daad3 100755
--- a/exe/bundle
+++ b/exe/bundle
@@ -16,5 +16,11 @@ end
require "bundler/friendly_errors"
Bundler.with_friendly_errors do
require "bundler/cli"
- Bundler::CLI.start(ARGV, :debug => true)
+
+ # Allow any command to use --help flag to show help for that command
+ help_flags = %w(--help -h)
+ help_flag_used = ARGV.any? {|a| help_flags.include? a }
+ args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV
+
+ Bundler::CLI.start(args, :debug => true)
end