summaryrefslogtreecommitdiff
path: root/chef/lib/chef/application
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-08-23 09:53:20 -0700
committerDaniel DeLeo <dan@opscode.com>2010-08-23 09:53:20 -0700
commit8afd9c40b246d6bc09917342a7d33432163f1b2c (patch)
tree10a2c6f4c31345288a8dc2d1281e2c0a6ff569c6 /chef/lib/chef/application
parent345cfc1c98677ef69a1ffb80d64210fbc5dbf478 (diff)
downloadchef-8afd9c40b246d6bc09917342a7d33432163f1b2c.tar.gz
refactor knife arg validation for clarity
Diffstat (limited to 'chef/lib/chef/application')
-rw-r--r--chef/lib/chef/application/knife.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/chef/lib/chef/application/knife.rb b/chef/lib/chef/application/knife.rb
index 4fd89066bd..bfd5fd15b3 100644
--- a/chef/lib/chef/application/knife.rb
+++ b/chef/lib/chef/application/knife.rb
@@ -125,11 +125,12 @@ class Chef::Application::Knife < Chef::Application
# Checking ARGV validity *before* parse_options because parse_options
# mangles ARGV in some situations
if no_subcommand_given?
- print_help_and_exit if want_help?
- print_help_and_exit if want_version?
- print_help_and_exit(2, "Sorry, you need to pass a sub-command first!")
+ if (want_help? || want_version?)
+ print_help_and_exit
+ else
+ print_help_and_exit(2, "Sorry, you need to pass a sub-command first!")
+ end
end
- print_help_and_exit if no_command_given?
end
def no_subcommand_given?