On Wed, Apr 21, 2010 at 11:54 AM, Jesse Wolfe <[email protected]> wrote:

> puppet --help should show generic usage, not puppet apply's help
>
> Signed-off-by: Jesse Wolfe <[email protected]>
> ---
>  lib/puppet/util/command_line.rb |    3 +++
>  spec/unit/util/command_line.rb  |    8 ++++++++
>  2 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/lib/puppet/util/command_line.rb
> b/lib/puppet/util/command_line.rb
> index bc870be..7c3b066 100644
> --- a/lib/puppet/util/command_line.rb
> +++ b/lib/puppet/util/command_line.rb
> @@ -4,6 +4,9 @@ module Puppet
>             def self.shift_subcommand_from_argv( argv = ARGV, stdin = STDIN
> )
>                 if ! argv.first
>                     "apply" unless stdin.tty? # ttys get usage info
> +                elsif argv.first == "--help"
> +                    # help should give you usage, not the help for `puppet
> apply`
> +                    nil
>                 elsif argv.first =~ /^-|\.pp$|\.rb$/
>                     "apply"
>                 else
>

Why I do believe this looks like one of those "case" statements I've heard
so much about:

   case argv.first
   when nil;                  "apply" unless stdin.tty? # ttys get usage
info
   when "--help";          nil # help should give you usage, not the help
for `puppet apply`
   when /^-|\.pp$|\.rb$/; "apply"
   else

-- M

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en.

Reply via email to