diff options
| author | Luke Kanies <luke@puppetlabs.com> | 2011-02-23 00:20:15 -0800 |
|---|---|---|
| committer | Luke Kanies <luke@puppetlabs.com> | 2011-02-23 00:20:15 -0800 |
| commit | 59a648502a8f09948bd2d25a72a9099f7740e108 (patch) | |
| tree | 3de97951a28a4710df603b86b69dec67211280bb /lib/puppet/application | |
| parent | 4fa54d02a2806e8fde54da9bb7e4d6735b3cffe4 (diff) | |
| download | puppet-59a648502a8f09948bd2d25a72a9099f7740e108.tar.gz puppet-59a648502a8f09948bd2d25a72a9099f7740e108.tar.xz puppet-59a648502a8f09948bd2d25a72a9099f7740e108.zip | |
Adding Application options to Interfaces
This allows all of the actions to react to the CLI
options.
I've also removed the unnecessary 'name' variables I
was using in various places - they were just the first
of the arguments, and they weren't actually always
names.
Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'lib/puppet/application')
| -rw-r--r-- | lib/puppet/application/interface_base.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/puppet/application/interface_base.rb b/lib/puppet/application/interface_base.rb index 49c2e9622..044249d39 100644 --- a/lib/puppet/application/interface_base.rb +++ b/lib/puppet/application/interface_base.rb @@ -32,7 +32,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application end - attr_accessor :interface, :type, :verb, :name, :arguments, :format + attr_accessor :interface, :type, :verb, :arguments, :format attr_writer :exit_code # This allows you to set the exit code if you don't want to just exit @@ -43,7 +43,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application def main # Call the method associated with the provided action (e.g., 'find'). - if result = interface.send(verb, name, *arguments) + if result = interface.send(verb, *arguments) puts render(result) end exit(exit_code) @@ -58,7 +58,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application def setup Puppet::Util::Log.newdestination :console - @verb, @name, @arguments = command_line.args + @verb, @arguments = command_line.args @arguments ||= [] @type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym @@ -68,6 +68,10 @@ class Puppet::Application::InterfaceBase < Puppet::Application end @format ||= @interface.default_format + # We copy all of the app options to the interface. + # This allows each action to read in the options. + @interface.options = options + validate end |
