Skip to content

Commit f4e8ea6

Browse files
committed
- Remove approvals.bash (bashly add test)
1 parent 52160e2 commit f4e8ea6

File tree

18 files changed

+201
-408
lines changed

18 files changed

+201
-408
lines changed

examples/completions/src/lib/send_completions.sh

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,38 @@ send_completions() {
77
echo $'# Modifying it manually is not recommended'
88
echo $''
99
echo $'_cli_completions_filter() {'
10-
echo $' local words=("$@")'
10+
echo $' local words="$1"'
1111
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
1212
echo $' local result=()'
13-
echo $' local want_options=0'
1413
echo $''
1514
echo $' # words the user already typed (excluding the command itself)'
1615
echo $' local used=()'
1716
echo $' if ((COMP_CWORD > 1)); then'
1817
echo $' used=("${COMP_WORDS[@]:1:$((COMP_CWORD - 1))}")'
1918
echo $' fi'
2019
echo $''
21-
echo $' # Completing an option: offer everything.'
22-
echo $' # Completing a non-option: drop options and already-used words.'
23-
echo $' [[ "${cur:0:1}" == "-" ]] && want_options=1'
24-
echo $' for word in "${words[@]}"; do'
25-
echo $' if ((!want_options)); then'
20+
echo $' if [[ "${cur:0:1}" == "-" ]]; then'
21+
echo $' # Completing an option: offer everything (including options)'
22+
echo $' echo "$words"'
23+
echo $''
24+
echo $' else'
25+
echo $' # Completing a non-option: offer only non-options,'
26+
echo $' # and don\'t re-offer ones already used earlier in the line.'
27+
echo $' for word in $words; do'
2628
echo $' [[ "${word:0:1}" == "-" ]] && continue'
2729
echo $''
30+
echo $' local seen=0'
2831
echo $' for u in "${used[@]}"; do'
2932
echo $' if [[ "$u" == "$word" ]]; then'
30-
echo $' continue 2'
33+
echo $' seen=1'
34+
echo $' break'
3135
echo $' fi'
3236
echo $' done'
33-
echo $' fi'
34-
echo $''
35-
echo $' # compgen -W expects shell-escaped words in one space-delimited string.'
36-
echo $' printf -v word \'%q\' "$word"'
37-
echo $' result+=("$word")'
38-
echo $' done'
37+
echo $' ((!seen)) && result+=("$word")'
38+
echo $' done'
3939
echo $''
40-
echo $' echo "${result[*]}"'
40+
echo $' echo "${result[*]}"'
41+
echo $' fi'
4142
echo $'}'
4243
echo $''
4344
echo $'_cli_completions() {'
@@ -52,51 +53,55 @@ send_completions() {
5253
echo $''
5354
echo $' case "$compline" in'
5455
echo $' \'download\'*\'--handler\')'
55-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl" "wget")" -- "$cur")'
56+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl wget")" -- "$cur")'
5657
echo $' ;;'
5758
echo $''
5859
echo $' \'upload\'*\'--user\')'
5960
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
6061
echo $' ;;'
6162
echo $''
6263
echo $' \'completions\'*)'
63-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help" "-h")" -- "$cur")'
64+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help -h")" -- "$cur")'
6465
echo $' ;;'
6566
echo $''
6667
echo $' \'d\'*\'--handler\')'
67-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl" "wget")" -- "$cur")'
68+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl wget")" -- "$cur")'
6869
echo $' ;;'
6970
echo $''
7071
echo $' \'upload\'*\'-u\')'
7172
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
7273
echo $' ;;'
7374
echo $''
7475
echo $' \'download\'*)'
75-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force" "--handler" "--help" "-f" "-h")" -- "$cur")'
76+
echo $' compopt -o filenames 2>/dev/null'
77+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force --handler --help -f -h")" -- "$cur")'
7678
echo $' ;;'
7779
echo $''
7880
echo $' \'u\'*\'--user\')'
7981
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
8082
echo $' ;;'
8183
echo $''
8284
echo $' \'upload\'*)'
83-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help" "--password" "--user" "-h" "-p" "-u" "CHANGELOG.md" "README.md")" -- "$cur")'
85+
echo $' compopt -o filenames 2>/dev/null'
86+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help --password --user -h -p -u CHANGELOG.md README.md")" -- "$cur")'
8487
echo $' ;;'
8588
echo $''
8689
echo $' \'u\'*\'-u\')'
8790
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
8891
echo $' ;;'
8992
echo $''
9093
echo $' \'d\'*)'
91-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force" "--handler" "--help" "-f" "-h")" -- "$cur")'
94+
echo $' compopt -o filenames 2>/dev/null'
95+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force --handler --help -f -h")" -- "$cur")'
9296
echo $' ;;'
9397
echo $''
9498
echo $' \'u\'*)'
95-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help" "--password" "--user" "-h" "-p" "-u" "CHANGELOG.md" "README.md")" -- "$cur")'
99+
echo $' compopt -o filenames 2>/dev/null'
100+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help --password --user -h -p -u CHANGELOG.md README.md")" -- "$cur")'
96101
echo $' ;;'
97102
echo $''
98103
echo $' *)'
99-
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help" "--version" "-h" "-v" "completions" "d" "download" "u" "upload")" -- "$cur")'
104+
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help --version -h -v completions d download u upload")" -- "$cur")'
100105
echo $' ;;'
101106
echo $''
102107
echo $' esac'

examples/render-mandoc/docs/download.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" Automatically generated by Pandoc 3.9
22
.\"
3-
.TH "download" "1" "February 2026" "Version 0.1.0" "Sample application"
3+
.TH "download" "1" "March 2026" "Version 0.1.0" "Sample application"
44
.SH NAME
55
\f[B]download\f[R] \- Sample application
66
.SH SYNOPSIS

examples/render-mandoc/docs/download.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
% download(1) Version 0.1.0 | Sample application
22
% Lana Lang
3-
% February 2026
3+
% March 2026
44

55
NAME
66
==================================================

lib/bashly/libraries/libraries.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,21 +121,6 @@ strings:
121121
- source: "strings/strings.yml"
122122
target: "%{user_source_dir}/bashly-strings.yml"
123123

124-
test:
125-
help: Add approval testing.
126-
files:
127-
- source: "test/approvals.bash"
128-
target: "%{user_target_dir}/test/approvals.bash"
129-
- source: "test/approve"
130-
target: "%{user_target_dir}/test/approve"
131-
132-
post_install_message: |
133-
Edit your tests in g`test/approve` and then run:
134-
135-
m`$ test/approve`
136-
137-
Docs: bu`https://github.com/DannyBen/approvals.bash`
138-
139124
validations:
140125
help: Add argument validation functions to the lib directory.
141126
files:

lib/bashly/libraries/test/approvals.bash

Lines changed: 0 additions & 172 deletions
This file was deleted.

lib/bashly/libraries/test/approve

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)