bashly 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bashly/concerns/renderable.rb +7 -0
- data/lib/bashly/extensions/string.rb +1 -1
- data/lib/bashly/libraries/settings/settings.yml +3 -0
- data/lib/bashly/settings.rb +6 -1
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/argument/usage.gtx +1 -1
- data/lib/bashly/views/command/examples_on_error.gtx +1 -1
- data/lib/bashly/views/command/initialize.gtx +1 -1
- data/lib/bashly/views/command/usage.gtx +1 -1
- data/lib/bashly/views/command/usage_args.gtx +1 -1
- data/lib/bashly/views/command/usage_examples.gtx +1 -1
- data/lib/bashly/views/environment_variable/usage.gtx +1 -1
- data/lib/bashly/views/flag/usage.gtx +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 429df4c59ef5a1dc0f1f9e332ab0b32b702fe5b83124c5ab04d784ef7d82bbc2
|
|
4
|
+
data.tar.gz: fdef11f71141111dea60129f9a9b855c669129010f5ec6e046fc0cdfafd9907f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17dcbf38797ebdd77898a53e09271cf7e0522c53af2f223910edc205f02d6ccd254eb4bcd11307f76656f14edaef253472efe0a9f699b9490f2ed3ef90746c85
|
|
7
|
+
data.tar.gz: 347ec4aebc9be7dcbcaef970db0465edf422b828361d3a37cfaa09337c372a1940a611b24a190af81dbb9857feeb8acc9c2d5662a39eac54df1f4504129c3424
|
|
@@ -51,6 +51,13 @@ module Bashly
|
|
|
51
51
|
File.exist? user_file_path(file)
|
|
52
52
|
end
|
|
53
53
|
|
|
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
|
+
|
|
54
61
|
private
|
|
55
62
|
|
|
56
63
|
def view_path(view)
|
|
@@ -84,6 +84,9 @@ strict: false
|
|
|
84
84
|
# (every 2 leading spaces will be converted to a tab character)
|
|
85
85
|
tab_indent: false
|
|
86
86
|
|
|
87
|
+
# Set the character width used to wrap help and example messages
|
|
88
|
+
word_wrap: 80
|
|
89
|
+
|
|
87
90
|
# Choose a post-processor for the generated script:
|
|
88
91
|
# formatter: internal # Use Bashly’s built-in formatter (removes extra newlines)
|
|
89
92
|
# formatter: external # Run the external command `shfmt --case-indent --indent 2`
|
data/lib/bashly/settings.rb
CHANGED
|
@@ -27,7 +27,8 @@ module Bashly
|
|
|
27
27
|
:tab_indent,
|
|
28
28
|
:target_dir,
|
|
29
29
|
:usage_colors,
|
|
30
|
-
:var_aliases
|
|
30
|
+
:var_aliases,
|
|
31
|
+
:word_wrap
|
|
31
32
|
)
|
|
32
33
|
|
|
33
34
|
def commands_dir
|
|
@@ -173,6 +174,10 @@ module Bashly
|
|
|
173
174
|
@var_aliases ||= get :var_aliases
|
|
174
175
|
end
|
|
175
176
|
|
|
177
|
+
def word_wrap
|
|
178
|
+
@word_wrap ||= get :word_wrap
|
|
179
|
+
end
|
|
180
|
+
|
|
176
181
|
private
|
|
177
182
|
|
|
178
183
|
def get(key)
|
data/lib/bashly/version.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= view_marker
|
|
2
2
|
|
|
3
3
|
> printf " %s\n" "{{ label.color(:arg) }}"
|
|
4
|
-
> printf "{{ help
|
|
4
|
+
> printf "{{ user_string help, indent: 4 }}\n"
|
|
5
5
|
|
|
6
6
|
if allowed
|
|
7
7
|
> printf " %s\n" "{{ strings[:allowed] % { values: allowed.join(', ') } }}"
|
|
@@ -3,6 +3,6 @@ if Settings.show_examples_on_error && examples
|
|
|
3
3
|
|
|
4
4
|
> printf "{{ strings[:examples_caption_on_error] }}\n" >&2
|
|
5
5
|
examples.each do |example|
|
|
6
|
-
> printf "{{ example
|
|
6
|
+
> printf "{{ user_string example, indent: 2 }}\n" >&2
|
|
7
7
|
end
|
|
8
8
|
end
|
|
@@ -9,7 +9,7 @@ else
|
|
|
9
9
|
= help_header_override.indent 4
|
|
10
10
|
else
|
|
11
11
|
> printf "{{ full_name }}\n\n"
|
|
12
|
-
> printf "{{ help
|
|
12
|
+
> printf "{{ user_string help, indent: 2 }}\n\n"
|
|
13
13
|
end
|
|
14
14
|
> else
|
|
15
15
|
> printf "{{ caption_string.sanitize_for_print }}\n\n"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= view_marker
|
|
2
2
|
|
|
3
3
|
> printf " %s\n" "{{ usage_string(extended: true).color(:environment_variable) }}"
|
|
4
|
-
> printf "{{ help
|
|
4
|
+
> printf "{{ user_string help, indent: 4 }}\n"
|
|
5
5
|
|
|
6
6
|
if allowed
|
|
7
7
|
> printf " %s\n" "{{ strings[:allowed] % { values: allowed.join(', ') } }}"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= view_marker
|
|
2
2
|
|
|
3
3
|
> printf " %s\n" "{{ usage_string(extended: true).color(:flag) }}"
|
|
4
|
-
> printf "{{ help
|
|
4
|
+
> printf "{{ user_string help, indent: 4 }}\n"
|
|
5
5
|
|
|
6
6
|
if allowed
|
|
7
7
|
> printf " %s\n" "{{ strings[:allowed] % { values: allowed.join(', ') } }}"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bashly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Danny Ben Shitrit
|
|
@@ -359,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
359
359
|
- !ruby/object:Gem::Version
|
|
360
360
|
version: '0'
|
|
361
361
|
requirements: []
|
|
362
|
-
rubygems_version:
|
|
362
|
+
rubygems_version: 4.0.0
|
|
363
363
|
specification_version: 4
|
|
364
364
|
summary: Bash Command Line Tool Generator
|
|
365
365
|
test_files: []
|