Please review pull request #766: Interpret global version option only if no face opened by (pcarlisle)
Description:
Some subcommands use --version for other purposes (particularly module), so
only interpret the --version or -V flag when no subcommand is specified. This
isn't the best solution, but it's good enough right now.
- Opened: Fri May 11 22:38:23 UTC 2012
- Based on: puppetlabs:master (2e9f6b7a8c60384cb3a3cd09796d0286b6d0f6e8)
- Requested merge: pcarlisle:maint/master/fix-printing-version (f523ecdc47daf739ab830ba68e2682535ab4e724)
Diff follows:
diff --git a/lib/puppet/util/command_line.rb b/lib/puppet/util/command_line.rb
index 4dee530..aba9461 100644
--- a/lib/puppet/util/command_line.rb
+++ b/lib/puppet/util/command_line.rb
@@ -52,14 +52,6 @@ def require_application(application)
# is basically where the bootstrapping process / lifecycle of an app
# begins.
def execute
- # We support printing the global version very early, unconditionally.
- # This doesn't replace declaring the option later, even if it means
- # that particular bit will never trigger.
- if @argv.include? "--version" or @argv.include? "-V"
- puts Puppet.version
- exit 0
- end
-
# Build up our settings - we don't need that until after version check.
Puppet::Util.exit_on_fail("intialize global default settings") do
Puppet.settings.initialize_global_settings(args)
@@ -84,7 +76,13 @@ def execute
unless subcommand_name.nil? then
puts "Error: Unknown Puppet subcommand '#{subcommand_name}'"
end
- puts "See 'puppet help' for help on available puppet subcommands"
+
+ # If the user is just checking the version, print that and exit
+ if @argv.include? "--version" or @argv.include? "-V"
+ puts Puppet.version
+ else
+ puts "See 'puppet help' for help on available puppet subcommands"
+ end
end
end
-- 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.
