From 63e2e56d3172bdc80aaca5f5ddde5811728e3c76 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 30 Apr 2010 14:54:07 -0700 Subject: feature #2276 Single Executable: subcommand method Extract the logic to determine the subcommand name into a method. Signed-off-by: Jesse Wolfe --- lib/puppet/application/resource.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/puppet/application/resource.rb') diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index ae4349850..78aed95c5 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -38,11 +38,12 @@ Puppet::Application.new(:resource) do end command(:main) do - type = ARGV.shift or raise "You must specify the type to display" + args = Puppet::Util::CommandLine.args + type = args.shift or raise "You must specify the type to display" typeobj = Puppet::Type.type(type) or raise "Could not find type #{type}" - name = ARGV.shift + name = args.shift params = {} - ARGV.each do |setting| + args.each do |setting| if setting =~ /^(\w+)=(.+)$/ params[$1] = $2 else -- cgit