diff options
author | Pieter van de Bruggen <pieter@puppetlabs.com> | 2011-04-17 22:23:44 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-17 22:23:44 -0700 |
commit | 9d2ec219bbd77bfca48a72b52fe5d0d3fcc0dcf7 (patch) | |
tree | 1b01ad690ce899fb688356ac2deb7eed4f50c302 /lib/puppet/interface/option.rb | |
parent | 0d0318f9f0eadff7f9934d3d02a7081bba05164c (diff) | |
download | puppet-9d2ec219bbd77bfca48a72b52fe5d0d3fcc0dcf7.tar.gz puppet-9d2ec219bbd77bfca48a72b52fe5d0d3fcc0dcf7.tar.xz puppet-9d2ec219bbd77bfca48a72b52fe5d0d3fcc0dcf7.zip |
(#7013) Add support for required options.
This adds another hook into the generated wrapper, which invokes a method to
validate arguments. This is used to raise an exception when required options
have not been passed to the method.
Reviewed-By: Daniel Pittman <daniel@puppetlabs.com>
Diffstat (limited to 'lib/puppet/interface/option.rb')
-rw-r--r-- | lib/puppet/interface/option.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/puppet/interface/option.rb b/lib/puppet/interface/option.rb index 2abcd4033..c04c2bf67 100644 --- a/lib/puppet/interface/option.rb +++ b/lib/puppet/interface/option.rb @@ -74,10 +74,12 @@ class Puppet::Interface::Option def optional_argument? !!@optional_argument end - + def required? + !!@required + end attr_reader :parent, :name, :aliases, :optparse - attr_accessor :desc + attr_accessor :required, :desc attr_accessor :before_action def before_action=(proc) |