dannypurcell / rubycom

Turn your library into a command-line app by simply including Rubycom.
http://dannypurcell.github.io/rubycom/
MIT License
5 stars 0 forks source link

Documentation should be justified when it overflows #3

Closed dannypurcell closed 11 years ago

dannypurcell commented 11 years ago

Try something like this width = 70 spacer = "" command.name.split(//).each{ spacer << " " } prefix = " #{spacer}\t" line_width = width - prefix.length description_msg = command.description.gsub(/(.{1,#{line_width}})(?: +|$)\n?|(.{#{line_width}})/, "#{prefix}\1\2\n") "#{command.name} #{description_msg.lstrip}\n"

dannypurcell commented 11 years ago

Resolved in 07fe6470792a8e83ccd715036a2e35233cccf59a