-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance help output formatting configurability
* Allow manual ordering of help commands, Closes #83 * Disable automatic wrapping always or only for non-TTY, Closes #100
- Loading branch information
1 parent
c80d256
commit 63c0823
Showing
14 changed files
with
201 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module GLI | ||
module Commands | ||
module HelpModules | ||
# Formats text in one line, stripping newlines and NOT wrapping | ||
class NoWrappingWrapper | ||
# Args are ignored entirely; this keeps it consistent with the TextWrapper interface | ||
def initialize(width,indent) | ||
end | ||
|
||
# Return a wrapped version of text, assuming that the first line has already been | ||
# indented by @indent characters. Resulting text does NOT have a newline in it. | ||
def wrap(text) | ||
return String(text).gsub(/\n+/,' ').strip | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module GLI | ||
module Commands | ||
module HelpModules | ||
# Formats text in one line, stripping newlines and NOT wrapping | ||
class TTYOnlyWrapper | ||
# Args are ignored entirely; this keeps it consistent with the TextWrapper interface | ||
def initialize(width,indent) | ||
@proxy = if STDOUT.tty? | ||
TextWrapper.new(width,indent) | ||
else | ||
NoWrappingWrapper.new(width,indent) | ||
end | ||
end | ||
|
||
# Return a wrapped version of text, assuming that the first line has already been | ||
# indented by @indent characters. Resulting text does NOT have a newline in it. | ||
def wrap(text) | ||
@proxy.wrap(text) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters