Issue #7718 has been updated by J.D. Welch.

Status changed from Needs Decision to Closed

This ticket appears to be stale and will be closed. Please re-activate if this 
issue is still a priority.
----------------------------------------
Refactor #7718: Faces handle default actions on the command line very 
strangely...
https://projects.puppetlabs.com/issues/7718#change-73051

Author: Daniel Pittman
Status: Closed
Priority: Normal
Assignee: J.D. Welch
Category: Faces
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


So, we have these default actions implemented on faces to support things like 
help.  Specifically, we have the behaviour that (after options are removed):

1. If you give no arguments on the command line, invoke the default actions.  
(expected, and reasonable.)
2. If you give arguments on the command line, and the first word matches an 
action, invoke that action.  (expected, and reasonable.)
3. If you give arguments on the command line, but the first word doesn't match 
an action, invoke the default action with all those words as arguments.  
(sometimes unexpected, sometimes reasonable.)

In the last case we have potentially surprising behaviour: *most* default 
actions want only a very specific set of arguments, and should fail somehow 
sensibly if you don't match their expectations.  I think.  It isn't entirely 
clear, though, that this is ever right.

Some-but-not-all default actions do want arguments, though: consider `puppet 
help node`, which is properly `puppet help <help> node` once the default action 
is substituted in, and absolutely does want the arguments.  Which we would like 
to support and, frankly, not restrict to things that we do.

Maybe some sort of `default, :arguments => accept` or something would be 
sensible, to determine if we want the greedy behaviour or not?  Maybe a richer 
`action_missing` hook for the face, allowing it to redirect invocation to where 
we expect, like Ruby does?  Maybe a richer `get_default_action` method that can 
take into account the arguments?


-- 
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