aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_ext
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-12-05 01:02:39 -0800
committerelijah <elijah@riseup.net>2012-12-05 01:02:39 -0800
commit5a5879c51afc128ea723443de26458ebdc645c6a (patch)
tree7e18cd0880526bd550a5e8945ecb683e7fdf1a00 /lib/lib_ext
parentcc2459bf72db3990d15b83d6a07c184794215777 (diff)
downloadleap_cli-5a5879c51afc128ea723443de26458ebdc645c6a.tar.gz
leap_cli-5a5879c51afc128ea723443de26458ebdc645c6a.tar.bz2
fixed problems with ruby 1.8 and GLI, and added some tests.
Diffstat (limited to 'lib/lib_ext')
-rw-r--r--lib/lib_ext/gli.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/lib_ext/gli.rb b/lib/lib_ext/gli.rb
index 32ae0bc..f9b03be 100644
--- a/lib/lib_ext/gli.rb
+++ b/lib/lib_ext/gli.rb
@@ -19,10 +19,10 @@ module GLI
# build a list of commands, sort them so the commands with subcommands are at the bottom
commands = @sorter.call(@app.commands_declaration_order.reject(&:nodoc)).sort do |a,b|
- if a.commands.any? && b.commands.any?; a.name <=> b.name
+ if a.commands.any? && b.commands.any?; a.name.to_s <=> b.name.to_s
elsif a.commands.any?; 1
elsif b.commands.any?; -1
- else; a.name <=> b.name
+ else; a.name.to_s <=> b.name.to_s
end
end
@@ -33,7 +33,7 @@ module GLI
command_info_list << [name, command.description]
if command.commands.any?
@sorter.call(command.commands_declaration_order).each do |cmd|
- command_info_list << [SUB_CMD_INDENT + command.name.to_s + " " + cmd.names,cmd.description + (command.get_default_command == cmd.name ? " (default)" : "")]
+ command_info_list << [SUB_CMD_INDENT + command.name.to_s + " " + cmd.names, cmd.description + (command.get_default_command == cmd.name ? " (default)" : "")]
end
end
end
@@ -43,7 +43,7 @@ module GLI
stringio = StringIO.new
command_formatter.output(stringio)
commands = stringio.string
- global_option_descriptions = OptionsFormatter.new(global_flags_and_switches,@wrapper_class).format
+ global_option_descriptions = OptionsFormatter.new(global_flags_and_switches, @sorter, @wrapper_class).format
GLOBAL_HELP.result(binding)
end
end