Issue #2420 has been updated by Luke Kanies.

Status changed from Needs design decision to Closed

This actually works fine.  We might have a different feature request -- the 
ability to use short options with negated boolean options -- but this one works 
fine.
----------------------------------------
Bug #2420: The getopt parser in application.rb only seems to handle long options
http://projects.reductivelabs.com/issues/2420

Author: James Turnbull
Status: Closed
Priority: Normal
Assigned to: Luke Kanies
Category: executables
Target version: 0.25.0
Complexity: Easy
Affected version: 0.24.8
Keywords: options daemonize


See this code block in application.rb:

<pre>
   # used to declare code that handle an option
    def option(*options, &block)
        long = options.find { |opt| opt =~ /^--/
}.gsub(/^--(?:\[no-\])?([^ =]+).*$/, '\1' ).gsub('-','_')
        fname = "handle_#{long}"
        if (block_given?)
            meta_def(symbolize(fname), &block)
        else
            meta_def(symbolize(fname)) do |value|
                self.options["#{long}".to_sym] = value
            end
        end
        @opt_parser.on(*options) do |value|
            self.send(symbolize(fname), value)
        end
    end
</pre>

Brice - not sure if I am understanding this correctly but wouldn't this ignore 
any short options?


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to