diff options
author | Akira Matsuda <ronnie@dio.jp> | 2010-07-04 17:37:57 +0900 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-07-07 16:20:56 -0700 |
commit | bf5d15456757e63598575db42917d702af9da729 (patch) | |
tree | 98fc34071f6f9659da5c1ac4debb6162bea38787 /railties | |
parent | ff44cc284441be894cc6f2bbc1798a21e881414e (diff) | |
download | rails-bf5d15456757e63598575db42917d702af9da729.tar.gz rails-bf5d15456757e63598575db42917d702af9da729.tar.bz2 rails-bf5d15456757e63598575db42917d702af9da729.zip |
Print proper "Usage:" messages for "rails plugin" command
* suppress outputting "Unknown command:" when no command were specified
* output the "Usage:" message when no plugin names were given
[#5043 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/commands/plugin.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/railties/lib/rails/commands/plugin.rb b/railties/lib/rails/commands/plugin.rb index e0930cdcee..96b6f9c372 100644 --- a/railties/lib/rails/commands/plugin.rb +++ b/railties/lib/rails/commands/plugin.rb @@ -335,7 +335,7 @@ module Commands command = Commands.const_get(command.capitalize).new(self) command.parse!(sub) else - puts "Unknown command: #{command}" + puts "Unknown command: #{command}" unless command.blank? puts options exit 1 end @@ -345,7 +345,7 @@ module Commands left = [] left << args.shift while args[0] and args[0] =~ /^-/ left << args.shift if args[0] - return [left, args] + [left, args] end def self.parse!(args=ARGV) @@ -410,6 +410,10 @@ module Commands def parse!(args) options.parse!(args) + if args.blank? + puts options + exit 1 + end environment = @base_command.environment install_method = determine_install_method puts "Plugins will be installed using #{install_method}" if $verbose @@ -438,6 +442,10 @@ module Commands def parse!(args) options.parse!(args) + if args.blank? + puts options + exit 1 + end root = @base_command.environment.root args.each do |name| ::Plugin.new(name).uninstall |