Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit d9d8699

Browse files
committed
Revert to previous version of #wrap_text and add new method for module descriptions
1 parent 02deae6 commit d9d8699

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/cli/module_info.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def print_description
1616
if context.module.module_description_preformatted
1717
print_std(indent_without_wrap(context.module.module_desc))
1818
else
19-
print_std(wrap_text(context.module.module_desc).strip)
19+
print_std(remove_new_lines_and_wrap_text(context.module.module_desc).strip)
2020
end
2121
end
2222
end

lib/cli/output.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ def indent_cursor(level = 1)
77
@indent_level -= level
88
end
99

10-
def wrap_text(s, padding = 0, width = 78)
10+
def remove_new_lines_and_wrap_text(s, padding = 0, width = 78)
1111
s.tr("\n", '')
1212
.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n#{@indent * @indent_level}#{' ' * padding}").chomp
1313
.gsub(/\s+$/, '')
1414
end
1515

16+
def wrap_text(s, padding = 0, width = 78)
17+
s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n#{@indent * @indent_level}#{' ' * padding}").chomp
18+
.gsub(/\s+$/, '')
19+
end
20+
1621
def indent_without_wrap(s)
1722
s.gsub(/\n/, "\n#{@indent * @indent_level}")
1823
end

0 commit comments

Comments
 (0)