Skip to content

Commit 7f93521

Browse files
authored
Merge pull request #102 from DannyBen/update/completely
Upgrade completely gem to allow completions for local scripts
2 parents 4b3c3b6 + d8fd173 commit 7f93521

File tree

8 files changed

+39
-32
lines changed

8 files changed

+39
-32
lines changed

bashly.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
1818
s.required_ruby_version = ">= 2.7.0"
1919

2020
s.add_runtime_dependency 'colsole', '~> 0.6'
21-
s.add_runtime_dependency 'completely', '~> 0.1', '>= 0.1.2'
21+
s.add_runtime_dependency 'completely', '~> 0.2'
2222
s.add_runtime_dependency 'mister_bin', '~> 0.7'
2323
s.add_runtime_dependency 'requires', '~> 0.1'
2424

examples/completions/cli

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,13 @@ send_completions() {
202202
echo $'# Modifying it manually is not recommended'
203203
echo $'_cli_completions() {'
204204
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
205+
echo $' local comp_line="${COMP_WORDS[*]:1}"'
205206
echo $''
206-
echo $' case "$COMP_LINE" in'
207-
echo $' \'cli completions\'*) COMPREPLY=($(compgen -W "--help -h" -- "$cur")) ;;'
208-
echo $' \'cli download\'*) COMPREPLY=($(compgen -A file -W "--force --help -f -h" -- "$cur")) ;;'
209-
echo $' \'cli upload\'*) COMPREPLY=($(compgen -A directory -A user -W "--help --password --user -h -p -u" -- "$cur")) ;;'
210-
echo $' \'cli\'*) COMPREPLY=($(compgen -W "--help --version -h -v completions download upload" -- "$cur")) ;;'
207+
echo $' case "$comp_line" in'
208+
echo $' \'completions\'*) COMPREPLY=($(compgen -W "--help -h" -- "$cur")) ;;'
209+
echo $' \'download\'*) COMPREPLY=($(compgen -A file -W "--force --help -f -h" -- "$cur")) ;;'
210+
echo $' \'upload\'*) COMPREPLY=($(compgen -A directory -A user -W "--help --password --user -h -p -u" -- "$cur")) ;;'
211+
echo $' \'\'*) COMPREPLY=($(compgen -W "--help --version -h -v completions download upload" -- "$cur")) ;;'
211212
echo $' esac'
212213
echo $'}'
213214
echo $''

examples/completions/src/lib/send_completions.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ send_completions() {
66
echo $'# Modifying it manually is not recommended'
77
echo $'_cli_completions() {'
88
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
9+
echo $' local comp_line="${COMP_WORDS[*]:1}"'
910
echo $''
10-
echo $' case "$COMP_LINE" in'
11-
echo $' \'cli completions\'*) COMPREPLY=($(compgen -W "--help -h" -- "$cur")) ;;'
12-
echo $' \'cli download\'*) COMPREPLY=($(compgen -A file -W "--force --help -f -h" -- "$cur")) ;;'
13-
echo $' \'cli upload\'*) COMPREPLY=($(compgen -A directory -A user -W "--help --password --user -h -p -u" -- "$cur")) ;;'
14-
echo $' \'cli\'*) COMPREPLY=($(compgen -W "--help --version -h -v completions download upload" -- "$cur")) ;;'
11+
echo $' case "$comp_line" in'
12+
echo $' \'completions\'*) COMPREPLY=($(compgen -W "--help -h" -- "$cur")) ;;'
13+
echo $' \'download\'*) COMPREPLY=($(compgen -A file -W "--force --help -f -h" -- "$cur")) ;;'
14+
echo $' \'upload\'*) COMPREPLY=($(compgen -A directory -A user -W "--help --password --user -h -p -u" -- "$cur")) ;;'
15+
echo $' \'\'*) COMPREPLY=($(compgen -W "--help --version -h -v completions download upload" -- "$cur")) ;;'
1516
echo $' esac'
1617
echo $'}'
1718
echo $''

spec/approvals/cli/add/comp-function-file

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ send_completions() {
66
echo $'# Modifying it manually is not recommended'
77
echo $'_cli_completions() {'
88
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
9+
echo $' local comp_line="${COMP_WORDS[*]:1}"'
910
echo $''
10-
echo $' case "$COMP_LINE" in'
11-
echo $' \'cli download\'*) COMPREPLY=($(compgen -W "--force --help -f -h" -- "$cur")) ;;'
12-
echo $' \'cli upload\'*) COMPREPLY=($(compgen -W "--help --password --user -h -p -u" -- "$cur")) ;;'
13-
echo $' \'cli\'*) COMPREPLY=($(compgen -W "--help --version -h -v download upload" -- "$cur")) ;;'
11+
echo $' case "$comp_line" in'
12+
echo $' \'download\'*) COMPREPLY=($(compgen -W "--force --help -f -h" -- "$cur")) ;;'
13+
echo $' \'upload\'*) COMPREPLY=($(compgen -W "--help --password --user -h -p -u" -- "$cur")) ;;'
14+
echo $' \'\'*) COMPREPLY=($(compgen -W "--help --version -h -v download upload" -- "$cur")) ;;'
1415
echo $' esac'
1516
echo $'}'
1617
echo $''

spec/approvals/cli/add/comp-script-file

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
# Modifying it manually is not recommended
66
_cli_completions() {
77
local cur=${COMP_WORDS[COMP_CWORD]}
8+
local comp_line="${COMP_WORDS[*]:1}"
89

9-
case "$COMP_LINE" in
10-
'cli download'*) COMPREPLY=($(compgen -W "--force --help -f -h" -- "$cur")) ;;
11-
'cli upload'*) COMPREPLY=($(compgen -W "--help --password --user -h -p -u" -- "$cur")) ;;
12-
'cli'*) COMPREPLY=($(compgen -W "--help --version -h -v download upload" -- "$cur")) ;;
10+
case "$comp_line" in
11+
'download'*) COMPREPLY=($(compgen -W "--force --help -f -h" -- "$cur")) ;;
12+
'upload'*) COMPREPLY=($(compgen -W "--help --password --user -h -p -u" -- "$cur")) ;;
13+
''*) COMPREPLY=($(compgen -W "--help --version -h -v download upload" -- "$cur")) ;;
1314
esac
1415
}
1516

spec/approvals/completions/function

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ custom_name() {
66
echo $'# Modifying it manually is not recommended'
77
echo $'_get_completions() {'
88
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
9+
echo $' local comp_line="${COMP_WORDS[*]:1}"'
910
echo $''
10-
echo $' case "$COMP_LINE" in'
11-
echo $' \'get\'*) COMPREPLY=($(compgen -A file -W "--force --help --verbose --version -h -v" -- "$cur")) ;;'
11+
echo $' case "$comp_line" in'
12+
echo $' \'\'*) COMPREPLY=($(compgen -A file -W "--force --help --verbose --version -h -v" -- "$cur")) ;;'
1213
echo $' esac'
1314
echo $'}'
1415
echo $''

spec/approvals/completions/script

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
# Modifying it manually is not recommended
66
_say_completions() {
77
local cur=${COMP_WORDS[COMP_CWORD]}
8+
local comp_line="${COMP_WORDS[*]:1}"
89

9-
case "$COMP_LINE" in
10-
'say goodbye universe'*) COMPREPLY=($(compgen -W "$(git branch) --color --help --verbose -c -h -v" -- "$cur")) ;;
11-
'say hello world'*) COMPREPLY=($(compgen -A directory -A user -W "--force --help --verbose -h" -- "$cur")) ;;
12-
'say goodbye'*) COMPREPLY=($(compgen -W "--help -h universe" -- "$cur")) ;;
13-
'say hello'*) COMPREPLY=($(compgen -W "--help -h world" -- "$cur")) ;;
14-
'say'*) COMPREPLY=($(compgen -W "--help --version -h -v goodbye hello" -- "$cur")) ;;
10+
case "$comp_line" in
11+
'goodbye universe'*) COMPREPLY=($(compgen -W "$(git branch) --color --help --verbose -c -h -v" -- "$cur")) ;;
12+
'hello world'*) COMPREPLY=($(compgen -A directory -A user -W "--force --help --verbose -h" -- "$cur")) ;;
13+
'goodbye'*) COMPREPLY=($(compgen -W "--help -h universe" -- "$cur")) ;;
14+
'hello'*) COMPREPLY=($(compgen -W "--help -h world" -- "$cur")) ;;
15+
''*) COMPREPLY=($(compgen -W "--help --version -h -v goodbye hello" -- "$cur")) ;;
1516
esac
1617
}
1718

spec/approvals/examples/completions

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ Options:
6868
# Modifying it manually is not recommended
6969
_cli_completions() {
7070
local cur=${COMP_WORDS[COMP_CWORD]}
71+
local comp_line="${COMP_WORDS[*]:1}"
7172

72-
case "$COMP_LINE" in
73-
'cli completions'*) COMPREPLY=($(compgen -W "--help -h" -- "$cur")) ;;
74-
'cli download'*) COMPREPLY=($(compgen -A file -W "--force --help -f -h" -- "$cur")) ;;
75-
'cli upload'*) COMPREPLY=($(compgen -A directory -A user -W "--help --password --user -h -p -u" -- "$cur")) ;;
76-
'cli'*) COMPREPLY=($(compgen -W "--help --version -h -v completions download upload" -- "$cur")) ;;
73+
case "$comp_line" in
74+
'completions'*) COMPREPLY=($(compgen -W "--help -h" -- "$cur")) ;;
75+
'download'*) COMPREPLY=($(compgen -A file -W "--force --help -f -h" -- "$cur")) ;;
76+
'upload'*) COMPREPLY=($(compgen -A directory -A user -W "--help --password --user -h -p -u" -- "$cur")) ;;
77+
''*) COMPREPLY=($(compgen -W "--help --version -h -v completions download upload" -- "$cur")) ;;
7778
esac
7879
}
7980

0 commit comments

Comments
 (0)