Issue #6780 has been updated by Daniel Pittman.
In the end, the second path (a `parameters` mapping of options down to positional parameters) seems the least intrusive option. However, for the first cut this should be done without addressing that: *only* options get validation and coercion. Once that is working we can revisit the decision about the second half, positional arguments, and tackle it from there. The final, unstated part of this is that we should have some mechanism that maps these coercions from the command line. That isn't required as part of the minimum feature, though, and just having *any* validation and coercion is a good start. My initial thought is a syntax like this: <pre> puppet face action --foo='whatever' # whatever is a string puppet face action --foo=yaml:'whatever' # whatever is parsed as YAML puppet face action --foo=@whatever # read from file whatever, as string puppet face action --foo=json:@whatever # read from file whatever, as JSON puppet face action --foo=json:- # - as argument means "stdin" puppet face action --foo=json:@- # ...here, too, because we might as well </pre> ...but I worry that is over-complex use of the parameter. ---------------------------------------- Feature #6780: Implement type checking/coercion for action args https://projects.puppetlabs.com/issues/6780 Author: Pieter van de Bruggen Status: Accepted Priority: Normal Assignee: Daniel Pittman Category: Faces Target version: 2.7.1 Affected Puppet version: 2.7.0rc1 Keywords: Branch: The expectation is that actions should be able to transparently have typechecked signatures, and that automatic coercions will happen for certain argument types. Consider: option "--foo FOO", String # => option requires a string; should it automatically to_s on an array? I suspect not... option "--foo FOO", Puppet::Resource::Catalog # => option requires a catalog, and should automatically convert. # also, it should have "--foo-type TYPE", [:yaml, :pson, :string, :hash] added... This makes interfacing the rich type system of Ruby with the command line's simple String-based interface simple. -- 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.
