Skip to content

Commit

Permalink
Rename to more correct name
Browse files Browse the repository at this point in the history
Related to #107, this class is somewhat braindead, but at least
it's now named more appropriately.
  • Loading branch information
davetron5000 committed Sep 30, 2012
1 parent 8e211d7 commit a0dfb53
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion features/step_definitions/todo_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/gli/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions lib/gli/commands/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/gli/commands/help_modules/tty_only_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a0dfb53

Please sign in to comment.