class SimpleScripting::Argv::ExitWithArgumentsHelpPrinting
Public Instance Methods
print_help(output, long_help)
click to toggle source
# File lib/simple_scripting/argv.rb, line 31 def print_help(output, long_help) parser_opts_help = parser_opts_copy.to_s if commands_stack.size > 0 parser_opts_help = parser_opts_help.sub!('[options]', commands_stack.join(' ') + ' [options]') end if args.size > 0 args_display = args.map { |name, mandatory| mandatory ? "<#{ name }>" : "[<#{ name }>]" }.join(' ') parser_opts_help = parser_opts_help.sub!(/^(Usage: .*)/) { |text| "#{text} #{args_display}" } end output.puts parser_opts_help output.puts "", long_help if long_help end