File tree Expand file tree Collapse file tree 13 files changed +26
-11
lines changed
examples/render-mandoc/docs Expand file tree Collapse file tree 13 files changed +26
-11
lines changed Original file line number Diff line number Diff line change 11.\" Automatically generated by Pandoc 3.2
22.\"
3- .TH "download" "1" "November 2025" "Version 0.1.0" "Sample application"
3+ .TH "download" "1" "December 2025" "Version 0.1.0" "Sample application"
44.SH NAME
55\f[B] download \f[ R ] \- Sample application
66.SH SYNOPSIS
Original file line number Diff line number Diff line change 11% download(1) Version 0.1.0 | Sample application
22% Lana Lang
3- % November 2025
3+ % December 2025
44
55NAME
66==================================================
Original file line number Diff line number Diff line change @@ -51,6 +51,13 @@ def user_file_exist?(file)
5151 File . exist? user_file_path ( file )
5252 end
5353
54+ # Returns a wrapped, indented and sanitized string
55+ # Designed to place help and example messages inside bash's 'printf'
56+ def user_string ( text , indent : 0 )
57+ wrap = Settings . word_wrap - indent
58+ text . wrap ( wrap ) . indent ( indent ) . sanitize_for_print
59+ end
60+
5461 private
5562
5663 def view_path ( view )
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def to_path
3333 tr ( ' ' , '/' ) . downcase
3434 end
3535
36- def wrap ( length = 80 )
36+ def wrap ( length )
3737 strip!
3838 split ( "\n " ) . collect! do |line |
3939 if line . length > length
Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ strict: false
8484# (every 2 leading spaces will be converted to a tab character)
8585tab_indent : false
8686
87+ # Set the character width used to wrap help and example messages
88+ word_wrap : 80
89+
8790# Choose a post-processor for the generated script:
8891# formatter: internal # Use Bashly’s built-in formatter (removes extra newlines)
8992# formatter: external # Run the external command `shfmt --case-indent --indent 2`
Original file line number Diff line number Diff line change @@ -27,7 +27,8 @@ class << self
2727 :tab_indent ,
2828 :target_dir ,
2929 :usage_colors ,
30- :var_aliases
30+ :var_aliases ,
31+ :word_wrap
3132 )
3233
3334 def commands_dir
@@ -173,6 +174,10 @@ def var_aliases
173174 @var_aliases ||= get :var_aliases
174175 end
175176
177+ def word_wrap
178+ @word_wrap ||= get :word_wrap
179+ end
180+
176181 private
177182
178183 def get ( key )
Original file line number Diff line number Diff line change 11= view_marker
22
33> printf " %s\n" "{{ label.color(:arg) }}"
4- > printf "{{ help.wrap(76). indent(4).sanitize_for_print }}\n"
4+ > printf "{{ user_string help, indent: 4 }}\n"
55
66if allowed
77 > printf " %s\n" "{{ strings[:allowed] % { values: allowed.join(', ') } }}"
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ if Settings.show_examples_on_error && examples
33
44 > printf "{{ strings[:examples_caption_on_error] }}\n" >&2
55 examples.each do |example|
6- > printf "{{ example.wrap(78). indent(2).sanitize_for_print }}\n" >&2
6+ > printf "{{ user_string example, indent: 2 }}\n" >&2
77 end
88end
Original file line number Diff line number Diff line change 99 = help_header_override.indent 4
1010 else
1111 > printf "{{ full_name }}\n\n"
12- > printf "{{ help.wrap(78). indent(2).sanitize_for_print }}\n\n"
12+ > printf "{{ user_string help, indent: 2 }}\n\n"
1313 end
1414 > else
1515 > printf "{{ caption_string.sanitize_for_print }}\n\n"
Original file line number Diff line number Diff line change 1212if catch_all.help
1313 >
1414 > echo " {{ catch_all.label }}"
15- > printf "{{ catch_all.help.wrap(76). indent(4).sanitize_for_print }}\n"
15+ > printf "{{ user_string catch_all.help, indent: 4 }}\n"
1616 > echo
1717end
1818
You can’t perform that action at this time.
0 commit comments