summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application/filebucket.rb
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 /lib/puppet/application/filebucket.rb
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 'lib/puppet/application/filebucket.rb')
-rw-r--r--lib/puppet/application/filebucket.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb
index ed67009aa..cd7c854af 100644
--- a/lib/puppet/application/filebucket.rb
+++ b/lib/puppet/application/filebucket.rb
@@ -12,18 +12,23 @@ Puppet::Application.new(:filebucket) do
option("--remote","-r")
option("--verbose","-v")
+ class << self
+ attr :args
+ end
+
dispatch do
- ARGV.shift
+ @args = Puppet::Util::CommandLine.args
+ args.shift
end
command(:get) do
- md5 = ARGV.shift
+ md5 = args.shift
out = @client.getfile(md5)
print out
end
command(:backup) do
- ARGV.each do |file|
+ args.each do |file|
unless FileTest.exists?(file)
$stderr.puts "%s: no such file" % file
next
@@ -38,8 +43,8 @@ Puppet::Application.new(:filebucket) do
end
command(:restore) do
- file = ARGV.shift
- md5 = ARGV.shift
+ file = args.shift
+ md5 = args.shift
@client.restore(file, md5)
end