bashly 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d333139a3555fdc50cdb3ddf21119712fcada4ab837f5703f29529f346c6ad24
4
- data.tar.gz: 0a40e42bfa542ed5d4f8d59792aa2a19518ae1c9098db0309f9349db391c74b2
3
+ metadata.gz: fa90db9009d993d431fb953ef48a36ea467cc1c050f679662ff07d0d1d1a7ef4
4
+ data.tar.gz: 12f338a3a26ca15cc4348bea85a224ba9912c0b5b4b9069d36cde356a5d05a11
5
5
  SHA512:
6
- metadata.gz: e601e098208e0a5de186279e67c001ff58c44536f09e5cea6815722e9bef3ec3dc1b257c1b9ca2267e94977f05514916a66f03721c88c5a795cab93e8eadb20d
7
- data.tar.gz: 670bcae80903cdabc5d76b5139b1c6d80b1ee3ca33af03078a340a847c4ef1385ca74ca08b2b0a274845f0be5ecfc7ecd9822575b8f8ea8cb3592b821df22760
6
+ metadata.gz: a1d869adeb7b3cb568d35298b1bda904deda5ec70b08ef1fcaf79c9d2ed7eee14bc019d339f9ec333e1c761dc780e1ffe227a19931aadf69fcf128ec5dc2684f
7
+ data.tar.gz: 515ea7cca14d880a3add63ff3f1a959f9bea9e419532526737ef119c078c4644ca0efab2935c080ebddefdd804e4759eddba0c2b0dff6cccd8daa7b9a6e6a541
@@ -47,6 +47,7 @@ ini_load() {
47
47
  elif [[ $line =~ $key_regex ]]; then
48
48
  key="${BASH_REMATCH[1]}"
49
49
  value="${BASH_REMATCH[2]}"
50
+ [[ $value == *\$* ]] && eval "value=\"$value\""
50
51
  ini["${section}${key}"]="$value"
51
52
  fi
52
53
  done <"$ini_file"
@@ -43,3 +43,21 @@ Add an authors string to your man pages.
43
43
  ```yaml
44
44
  x_mandoc_authors: Lana Lang
45
45
  ```
46
+
47
+ ### See Also: `x_mandoc_see_also`
48
+
49
+ Adds additional pages to the `SEE ALSO` section, in addition to the
50
+ pages that are added automatically (like the parent command, and
51
+ sub commands).
52
+
53
+ This property should be an array of strings. You can optionally add
54
+ a section number in parentheses. If not provided, `(1)` will be used
55
+ as default.
56
+
57
+ #### Example
58
+
59
+ ```yaml
60
+ x_mandoc_see_also:
61
+ - docker
62
+ - docker-compose.yml(5)
63
+ ```
@@ -181,14 +181,19 @@ if examples
181
181
  >
182
182
  end
183
183
 
184
- if public_commands.any? || parents.any?
184
+ see_also = []
185
+ see_also << parents.first if parents.any?
186
+ see_also += public_commands.map { |x| x.full_name.to_hyphen } if public_commands.any?
187
+ see_also += x_mandoc_see_also if x_mandoc_see_also && x_mandoc_see_also.is_a?(Array)
188
+ see_also.map! do |item|
189
+ item.match(/(.+)(\(\d\))/) ? "**#{$1}**#{$2}" : "**#{item}**(1)"
190
+ end
191
+
192
+ if see_also.any?
185
193
  > SEE ALSO
186
194
  > ==================================================
187
195
  >
188
- if parents.any?
189
- > **{{ parents.first }}**(1)
190
- end
191
- = public_commands.map { |x| "**#{x.full_name.to_hyphen}**(1)" }.join ', '
196
+ = see_also.join ', '
192
197
  >
193
198
  end
194
199
 
@@ -1,4 +1,4 @@
1
- # approvals.bash v0.3.3
1
+ # approvals.bash v0.4.0
2
2
  #
3
3
  # Interactive approval testing for Bash.
4
4
  # https://github.com/DannyBen/approvals.bash
@@ -9,6 +9,10 @@ approve() {
9
9
  cmd=$1
10
10
  last_exit_code=0
11
11
  actual=$(eval "$cmd" 2>&1) || last_exit_code=$?
12
+ if [[ "$allow_diff_regex" ]]; then
13
+ actual=$(echo "$actual" | sed "s/$allow_diff_regex/*/g")
14
+ unset allow_diff_regex
15
+ fi
12
16
  approval=$(printf "%b" "$cmd" | tr -s -c "[:alnum:]" _)
13
17
  approval_file="$approvals_dir/${2:-"$approval"}"
14
18
 
@@ -35,6 +39,10 @@ approve() {
35
39
  fi
36
40
  }
37
41
 
42
+ allow_diff() {
43
+ allow_diff_regex="$1"
44
+ }
45
+
38
46
  describe() {
39
47
  echo
40
48
  blue "= $*"
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'tmpdir'
2
3
 
3
4
  module Bashly
4
5
  class LibrarySource
@@ -14,7 +15,7 @@ module Bashly
14
15
  end
15
16
 
16
17
  def config
17
- @config ||= YAML.load_file config_path
18
+ @config ||= LibrarySourceConfig.new(config_path).validated_data
18
19
  end
19
20
 
20
21
  def libraries
@@ -0,0 +1,48 @@
1
+ module Bashly
2
+ class LibrarySourceConfig
3
+ include ValidationHelpers
4
+
5
+ attr_reader :path
6
+
7
+ def initialize(path)
8
+ @path = path
9
+ end
10
+
11
+ def data
12
+ @data ||= YAML.load_file path
13
+ end
14
+
15
+ def validated_data
16
+ validate
17
+ data
18
+ end
19
+
20
+ def validate
21
+ assert_root path, data
22
+ end
23
+
24
+ private
25
+
26
+ def assert_root(path, value)
27
+ assert_hash path, value
28
+ data.each { |id, spec| assert_lib "[#{path}] #{id}", spec }
29
+ end
30
+
31
+ def assert_lib(key, value)
32
+ assert_string "#{key}.help", value['help']
33
+
34
+ assert_optional_string "#{key}.usage", value['usage']
35
+ assert_optional_string "#{key}.handler", value['handler']
36
+ assert_optional_string "#{key}.post_install_message", value['post_install_message']
37
+
38
+ return if value['handler']
39
+
40
+ assert_array "#{key}.files", value['files'], of: :filespec
41
+ end
42
+
43
+ def assert_filespec(key, value)
44
+ assert_string "#{key}.source", value['source']
45
+ assert_string "#{key}.target", value['target']
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
data/lib/bashly.rb CHANGED
@@ -15,6 +15,7 @@ module Bashly
15
15
  autoload :ConfigValidator, 'bashly/config_validator'
16
16
  autoload :Library, 'bashly/library'
17
17
  autoload :LibrarySource, 'bashly/library_source'
18
+ autoload :LibrarySourceConfig, 'bashly/library_source_config'
18
19
  autoload :MessageStrings, 'bashly/message_strings'
19
20
  autoload :RenderContext, 'bashly/render_context'
20
21
  autoload :RenderSource, 'bashly/render_source'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bashly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-28 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
@@ -207,6 +207,7 @@ files:
207
207
  - lib/bashly/libraries/yaml/yaml.sh
208
208
  - lib/bashly/library.rb
209
209
  - lib/bashly/library_source.rb
210
+ - lib/bashly/library_source_config.rb
210
211
  - lib/bashly/message_strings.rb
211
212
  - lib/bashly/refinements/compose_refinements.rb
212
213
  - lib/bashly/render_context.rb