lib/support/help.rb in gli-1.2.5 vs lib/support/help.rb in gli-1.2.6
- old
+ new
@@ -1,13 +1,13 @@
require 'gli'
require 'gli/command'
require 'gli/terminal'
module GLI
- class DefaultHelpCommand < Command
+ class DefaultHelpCommand < Command #:nodoc:
@@output = $stdout
- # Exposed for testing :nodoc:
+ # Exposed for testing
def self.output_device=(o); @@output = o; end
def initialize(version,*omit_from_list)
@omit_from_list = omit_from_list
@version = version
@@ -45,22 +45,24 @@
end
private
def list_global_flags
- usage = "usage: #{GLI.program_name} command"
+ usage = "usage: #{GLI.program_name} "
all_options = GLI.switches.merge(GLI.flags)
if !all_options.empty?
- usage += ' [options]'
+ usage += "[global options] "
end
+ usage += "command"
+ usage += ' [command options]'
@@output.puts usage
@@output.puts
if @version
@@output.puts "Version: #{@version}"
@@output.puts
end
- @@output.puts 'Options:' if !all_options.empty?
+ @@output.puts 'Global Options:' if !all_options.empty?
output_command_tokens_for_help(all_options)
@@output.puts if !all_options.empty?
end
def list_commands
@@ -83,10 +85,10 @@
@@output.puts " #{wrap(command.long_description,4)}"
end
all_options = command.switches.merge(command.flags)
if !all_options.empty?
@@output.puts
- @@output.puts "Options:"
+ @@output.puts "Command Options:"
output_command_tokens_for_help(all_options)
end
else
@@output.puts "No such command #{command_name}"
end