added dynamic resizing of description for flag & the like
This commit is contained in:
@@ -3,13 +3,15 @@ Command: <%= @name %>
|
||||
Description: <%= @description %>
|
||||
<%- end -%>
|
||||
|
||||
<%- len = @flags.map{|f| f.short.nil? ? f.long.size : "#{f.short},#{f.long}".size}.max + 5 -%>
|
||||
|
||||
Flags:
|
||||
---------------------------------------------------------------
|
||||
<%- @flags.each do |flag| -%>
|
||||
<%- unless flag.short.nil? -%>
|
||||
<%= "%-30s %s" % ["#{flag.short.not_nil!.strip},#{flag.long.strip}", flag.description.strip] %>
|
||||
<%= "%-#{len}s %s" % ["#{flag.short.not_nil!.strip},#{flag.long.strip}", flag.description.strip] %>
|
||||
<%- else -%>
|
||||
<%= "%-30s %s" % [flag.long.strip, flag.description.strip] %>
|
||||
<%= "%-#{len}s %s" % [flag.long.strip, flag.description.strip] %>
|
||||
<%- end -%>
|
||||
|
||||
<%- end -%>
|
||||
@@ -17,7 +19,7 @@ Flags:
|
||||
Other Commands
|
||||
---------------------------------------------------------------
|
||||
<%- @commands.each do |command| -%>
|
||||
<%= "%-30s %s" % [ command.name, command.description ] %>
|
||||
<%= "%-#{len}s %s" % [ command.name, command.description ] %>
|
||||
<%- end -%>
|
||||
|
||||
<%- end -%>
|
||||
@@ -25,7 +27,7 @@ Other Commands
|
||||
SubCommands of <%= @name %>:
|
||||
---------------------------------------------------------------
|
||||
<%- subcommands.each do |cmd| -%>
|
||||
<%= "%-30s %s" % [cmd.name, cmd.description] %>
|
||||
<%= "%-#{len}s %s" % [cmd.name, cmd.description] %>
|
||||
<%- end -%>
|
||||
|
||||
<%- cmds = subcommands.select{|c| ! c.examples.nil? } -%>
|
||||
|
||||
Reference in New Issue
Block a user