diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index deb27906..953b96ad 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -7,7 +7,7 @@ end Given /^the todo app is coded to avoid wrapping text$/ do - ENV['TODO_WRAP_HELP_TEXT'] = 'never' + ENV['TODO_WRAP_HELP_TEXT'] = 'one_line' end Given /^the todo app is coded to wrap text only for tty$/ do diff --git a/lib/gli/app.rb b/lib/gli/app.rb index da6fa8cf..42411ce1 100644 --- a/lib/gli/app.rb +++ b/lib/gli/app.rb @@ -229,8 +229,8 @@ def sort_help(sort_type) # # wrap_type:: Symbol indicating how you'd like text wrapped: # +:to_terminal+:: Wrap text based on the width of the terminal (default) - # +:never+:: Do not wrap text at all. This will bring all help content onto one line, removing any newlines - # +:tty_only+:: Wrap like +:to_terminal+ if this output is going to a TTY, otherwise don't wrap (like +:never+) + # +:one_line+:: Do not wrap text at all. This will bring all help content onto one line, removing any newlines + # +:tty_only+:: Wrap like +:to_terminal+ if this output is going to a TTY, otherwise don't wrap (like +:one_line+) def wrap_help_text(wrap_type) @help_text_wrap_type = wrap_type end diff --git a/lib/gli/commands/help.rb b/lib/gli/commands/help.rb index 542716b4..5617de38 100644 --- a/lib/gli/commands/help.rb +++ b/lib/gli/commands/help.rb @@ -3,7 +3,7 @@ require 'gli/terminal' require 'gli/commands/help_modules/list_formatter' require 'gli/commands/help_modules/text_wrapper' -require 'gli/commands/help_modules/no_wrapping_wrapper' +require 'gli/commands/help_modules/one_line_wrapper' require 'gli/commands/help_modules/tty_only_wrapper' require 'gli/commands/help_modules/options_formatter' require 'gli/commands/help_modules/global_help_format' @@ -21,7 +21,8 @@ module Commands WRAPPERS = { :to_terminal => HelpModules::TextWrapper, - :never => HelpModules::NoWrappingWrapper, + :never => HelpModules::OneLineWrapper, + :one_line => HelpModules::OneLineWrapper, :tty_only => HelpModules::TTYOnlyWrapper, } # The help command used for the two-level interactive help system diff --git a/lib/gli/commands/help_modules/no_wrapping_wrapper.rb b/lib/gli/commands/help_modules/one_line_wrapper.rb similarity index 94% rename from lib/gli/commands/help_modules/no_wrapping_wrapper.rb rename to lib/gli/commands/help_modules/one_line_wrapper.rb index e2e07def..a126219f 100644 --- a/lib/gli/commands/help_modules/no_wrapping_wrapper.rb +++ b/lib/gli/commands/help_modules/one_line_wrapper.rb @@ -2,7 +2,7 @@ module GLI module Commands module HelpModules # Formats text in one line, stripping newlines and NOT wrapping - class NoWrappingWrapper + class OneLineWrapper # Args are ignored entirely; this keeps it consistent with the TextWrapper interface def initialize(width,indent) end diff --git a/lib/gli/commands/help_modules/tty_only_wrapper.rb b/lib/gli/commands/help_modules/tty_only_wrapper.rb index d4c99c78..07f74e5a 100644 --- a/lib/gli/commands/help_modules/tty_only_wrapper.rb +++ b/lib/gli/commands/help_modules/tty_only_wrapper.rb @@ -8,7 +8,7 @@ def initialize(width,indent) @proxy = if STDOUT.tty? TextWrapper.new(width,indent) else - NoWrappingWrapper.new(width,indent) + OneLineWrapper.new(width,indent) end end