Permalink
Browse files

Format multiline program and command descriptions

Apply indentation to multiline program and command descriptions.
Fixes #54.
  • Loading branch information...
1 parent 8d39123 commit 9ea5c0f943d4df79cbbda01b0486d9333269aedd @ggilder ggilder committed Jul 21, 2013
@@ -4,5 +4,10 @@ module HelpFormatter
autoload :Base, 'commander/help_formatters/base'
autoload :Terminal, 'commander/help_formatters/terminal'
autoload :TerminalCompact, 'commander/help_formatters/terminal_compact'
+
+ module_function
+ def indent amount, text
+ text.gsub("\n", "\n" + (' ' * amount))
+ end
end
-end
+end
@@ -12,7 +12,7 @@
<%= $terminal.color "DESCRIPTION", :bold %>:
- <%= @description || @summary || 'No description.' -%>
+ <%= Commander::HelpFormatter.indent 4, (@description || @summary || 'No description.') -%>
<% unless @examples.empty? -%>
@@ -4,7 +4,7 @@
<%= $terminal.color "DESCRIPTION", :bold %>:
- <%= program :description %>
+ <%= Commander::HelpFormatter.indent 4, program(:description) %>
<%= $terminal.color "COMMANDS", :bold %>:
<% for name, command in @commands.sort -%>

0 comments on commit 9ea5c0f

Please sign in to comment.