Issue #8542 has been reported by Daniel Pittman.

----------------------------------------
Feature #8542: Implement type checking/coercion for *positional* action args 
https://projects.puppetlabs.com/issues/8542

Author: Daniel Pittman
Status: Accepted
Priority: Normal
Assignee: 
Category: Faces
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


As part of #6780, we identified a need to perform the same sort of type 
checking and coercion for positional arguments that we do for named arguments 
(aka options).

This is valuable for things like, for example, getting the `puppet status` 
invocation through the indirector working correctly.  (See #7123, but the 
precis is that `puppet status` should end up invoking `puppet status find 
dummy` to work around limitations of the indirector.)

The visible part of the implementation is:
<pre>
action :foo do
  option "--alpha" # ...sets type checking stuff
  option "--beta"   # ditto
  parameters :alpha, :beta
  when_invoked do |alpha, beta, options|
    # ...magic happens
  end
end
</pre>

The `parameters` declaration maps named options into positional parameters by 
explicitly declaring their order and name; the regular options stuff makes it 
possible to document, type, and all other things those arguments.

Then, the invocation code can identify what the appropriate types for each 
positional argument are.


-- 
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://projects.puppetlabs.com/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