completely 0.8.0.rc1 → 0.8.0.rc2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f63b147e4b4e7f96c823f6cced45b7a22a495a97318b04e105fd70ca6fe22358
4
- data.tar.gz: d361744ab7255d15b6fed24fd662591a8b2fab91696a0e79490c988c18e0438d
3
+ metadata.gz: 6d0582777cb78d66e4490a8f7f941de869281ab50aef1ad4cb9a6a57461fb45b
4
+ data.tar.gz: dafc8bdb605da6cde23bf30a8a0fdea1b989509b44dce37a83a91c64376ed3ad
5
5
  SHA512:
6
- metadata.gz: ae9f53dc80b932438d14c2be2e430880e9ae0b326abb3db8fd2e9d20abb09cba18cc631a8f73cda1ccb6b070f0f23c2d5bddc436f3f4cd771f5a4fa278bc599b
7
- data.tar.gz: 84966032ec9b12086c0722948e8da2070cdbc57a4d8aaba8f456581a0b88192a0ff7fba334631eae2c33d099ff23c48fbaa42bb141c9314d41083598d112d144
6
+ metadata.gz: 72d2fe448ef4fd313da9ca850c1b6a71f60882d84023c724a85fff6f777b128c8e542db0c2e373a6423e65960aaec3977990ac845744244adef89b80bfd4bb23
7
+ data.tar.gz: '081b9173573eed04ce23afed2aa8fad0f94ab242f6975d07d15ad124afb21a1281d44bbae6ac161262177025bf8021975694699890384f8f975393c43fcd0796'
@@ -1,7 +1,5 @@
1
1
  module Completely
2
2
  class Pattern
3
- DYNAMIC_WORD_PREFIX = '__completely_dynamic__'
4
-
5
3
  attr_reader :text, :completions, :function_name
6
4
 
7
5
  def initialize(text, completions, function_name)
@@ -65,9 +63,7 @@ module Completely
65
63
  end
66
64
 
67
65
  def serialize_word(word)
68
- if dynamic_word?(word)
69
- return %("#{DYNAMIC_WORD_PREFIX}#{escape_for_double_quotes word}")
70
- end
66
+ return word if dynamic_word?(word)
71
67
 
72
68
  %("#{escape_for_double_quotes word}")
73
69
  end
@@ -9,7 +9,6 @@
9
9
  local cur=${COMP_WORDS[COMP_CWORD]}
10
10
  local result=()
11
11
  local want_options=0
12
- local dynamic_prefix="<%= Completely::Pattern::DYNAMIC_WORD_PREFIX %>"
13
12
 
14
13
  # words the user already typed (excluding the command itself)
15
14
  local used=()
@@ -21,29 +20,19 @@
21
20
  # Completing a non-option: drop options and already-used words.
22
21
  [[ "${cur:0:1}" == "-" ]] && want_options=1
23
22
  for word in "${words[@]}"; do
24
- local candidates=("$word")
25
- if [[ "$word" == "$dynamic_prefix"* ]]; then
26
- word="${word#"$dynamic_prefix"}"
27
- word="${word//$'\r'/ }"
28
- word="${word//$'\n'/ }"
29
- read -r -a candidates <<<"$word"
30
- fi
31
-
32
- for candidate in "${candidates[@]}"; do
33
- if ((!want_options)); then
34
- [[ "${candidate:0:1}" == "-" ]] && continue
23
+ if ((!want_options)); then
24
+ [[ "${word:0:1}" == "-" ]] && continue
35
25
 
36
- for u in "${used[@]}"; do
37
- if [[ "$u" == "$candidate" ]]; then
38
- continue 2
39
- fi
40
- done
41
- fi
26
+ for u in "${used[@]}"; do
27
+ if [[ "$u" == "$word" ]]; then
28
+ continue 2
29
+ fi
30
+ done
31
+ fi
42
32
 
43
- # compgen -W expects shell-escaped words in one space-delimited string.
44
- printf -v candidate '%q' "$candidate"
45
- result+=("$candidate")
46
- done
33
+ # compgen -W expects shell-escaped words in one space-delimited string.
34
+ printf -v word '%q' "$word"
35
+ result+=("$word")
47
36
  done
48
37
 
49
38
  echo "${result[*]}"
@@ -70,6 +59,7 @@
70
59
  % patterns.each do |pattern|
71
60
  % next if pattern.empty?
72
61
  <%= pattern.case_string %>)
62
+ # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions
73
63
  while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen <%= pattern.compgen %> -- "$cur")
74
64
  ;;
75
65
 
@@ -1,3 +1,3 @@
1
1
  module Completely
2
- VERSION = '0.8.0.rc1'
2
+ VERSION = '0.8.0.rc2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: completely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.rc1
4
+ version: 0.8.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit