summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-04-30 14:54:07 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit63e2e56d3172bdc80aaca5f5ddde5811728e3c76 (patch)
tree38e3607fe83223d135f1c327682dbd8698bb138d /bin
parentb6e2ce6a85c953fcd57a3b837ccaa794a634dc22 (diff)
downloadpuppet-63e2e56d3172bdc80aaca5f5ddde5811728e3c76.tar.gz
puppet-63e2e56d3172bdc80aaca5f5ddde5811728e3c76.tar.xz
puppet-63e2e56d3172bdc80aaca5f5ddde5811728e3c76.zip
feature #2276 Single Executable: subcommand method
Extract the logic to determine the subcommand name into a method. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppet12
1 files changed, 6 insertions, 6 deletions
diff --git a/bin/puppet b/bin/puppet
index 5e619de6e..a326ba148 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -77,13 +77,13 @@ usage = "Usage: puppet command <space separated arguments>"
available = "Available commands are: #{builtins.sort.join(', ')}"
require 'puppet/util/command_line'
-$puppet_subcommand_name = Puppet::Util::CommandLine.shift_subcommand_from_argv
+subcommand_name = Puppet::Util::CommandLine.subcommand_name
-if $puppet_subcommand_name.nil?
+if subcommand_name.nil?
puts usage, available
-elsif builtins.include?($puppet_subcommand_name) #subcommand
- require File.join(appdir, $puppet_subcommand_name)
- Puppet::Application[$puppet_subcommand_name].run
+elsif builtins.include?(subcommand_name) #subcommand
+ require File.join(appdir, subcommand_name)
+ Puppet::Application[subcommand_name].run
else
- abort "Error: Unknown command #{$puppet_subcommand_name}.\n#{usage}\n#{available}"
+ abort "Error: Unknown command #{subcommand_name}.\n#{usage}\n#{available}"
end