diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..252ce00 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,69 @@ +# AGENTS.md + +Guidance for coding agents working in this repository. + +## Repo Snapshot + +- Project: `completely` (Ruby gem that generates Bash completion scripts from YAML). +- Key generation code: + - `lib/completely/pattern.rb` + - `lib/completely/templates/template.erb` +- Core behavior tests: + - `spec/completely/integration_spec.rb` + - `spec/completely/commands/generate_spec.rb` + +## Working Rules + +- Keep changes minimal and localized, especially in: + - completion-word serialization (`Pattern`) + - generated script runtime behavior (`template.erb`) +- Do not change generated approvals. +- Do not run approval prompts interactively on behalf of the developer. +- If an approval spec changes, stop and ask the developer to review/approve manually. +- Prefer adding regression coverage in integration fixtures for completion behavior changes. + +## Fast Validation Loop + +Run these first after edits: + +```bash +respec tagged script_quality +respec only integration +``` + +If touching quoting/escaping or dynamic completions, also run: + +```bash +respec only pattern +respec only completions +``` + +## Formatting and Linting Notes + +- `shellcheck` and `shfmt` requirements are enforced by specs tagged `:script_quality` in `spec/completely/commands/generate_spec.rb`. +- `shfmt` uses flags: + - `shfmt -d -i 2 -ci completely.bash` +- Small whitespace differences in heredoc/redirect forms (like `<<<"$x"` vs `<<< "$x"`) can fail shfmt. + +## Approval Specs + +- Some specs use `rspec_approvals` and may prompt interactively if output changes. +- In non-interactive runs this can fail with `Errno::ENOTTY`. +- Approval decisions are always developer-owned. Agents should not approve/update snapshots. + +## Completion Semantics to Preserve + +- Literal YAML words with spaces/quotes must complete correctly. +- Dynamic `$(...)` entries must produce multiple completion candidates when command output contains multiple words. +- ``, ``, and other `<...>` entries map to `compgen -A ...` actions and should remain unaffected by `-W` serialization changes. + +## Manual Repro Pattern + +Useful local sanity check: + +```bash +cd dev +ruby -I../lib ../bin/completely test "cli " +``` + +Expected: sensible mixed output for dynamic values and quoted/spaced literals. diff --git a/lib/completely/pattern.rb b/lib/completely/pattern.rb index 1c6f6b7..92333a2 100644 --- a/lib/completely/pattern.rb +++ b/lib/completely/pattern.rb @@ -54,12 +54,22 @@ def compgen def compgen! result = [] result << actions.join(' ').to_s if actions.any? - result << %[-W "$(#{function_name} #{quoted_words.join ' '})"] if words.any? + result << %[-W "$(#{function_name} #{serialized_words.join ' '})"] if words.any? result.any? ? result.join(' ') : nil end - def quoted_words - @quoted_words ||= words.map { |word| %("#{escape_for_double_quotes word}") } + def serialized_words + @serialized_words ||= words.map { |word| serialize_word(word) } + end + + def serialize_word(word) + return word if dynamic_word?(word) + + %("#{escape_for_double_quotes word}") + end + + def dynamic_word?(word) + word.match?(/\A\$\(.+\)\z/) end def escape_for_double_quotes(word) diff --git a/lib/completely/templates/template.erb b/lib/completely/templates/template.erb index 8b46f92..45bb795 100644 --- a/lib/completely/templates/template.erb +++ b/lib/completely/templates/template.erb @@ -59,6 +59,7 @@ % patterns.each do |pattern| % next if pattern.empty? <%= pattern.case_string %>) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen <%= pattern.compgen %> -- "$cur") ;; diff --git a/lib/completely/version.rb b/lib/completely/version.rb index 407dc87..bbe5efd 100644 --- a/lib/completely/version.rb +++ b/lib/completely/version.rb @@ -1,3 +1,3 @@ module Completely - VERSION = '0.7.4' + VERSION = '0.8.0.rc2' end diff --git a/spec/README.md b/spec/README.md index 25343ef..c00362f 100644 --- a/spec/README.md +++ b/spec/README.md @@ -2,19 +2,29 @@ ## Running tests +You can run specs with `rspec` as usual. + +We recommend using [`respec`][2], which wraps common spec workflows: + ```bash -$ rspec +rspec # or -$ run spec -# or, to run just tests in a given file -$ run spec zsh -# or, to run just specs tagged with :focus -$ run spec :focus +respec ``` You might need to prefix the commands with `bundle exec`, depending on the way Ruby is installed. +Useful helper shortcuts: + +```bash +# script quality checks (shellcheck + shfmt generated script tests) +respec tagged script_quality + +# integration behavior suite +respec only integration +``` + ## Interactive Approvals Some tests may prompt you for an interactive approval of changes. This @@ -29,4 +39,5 @@ ZSH compatibility test is done by running the completely tester script inside a zsh container. This is all done automatically by `spec/completely/zsh_spec.rb`. -[1]: https://github.com/dannyben/rspec_approvals \ No newline at end of file +[1]: https://github.com/dannyben/rspec_approvals +[2]: https://github.com/DannyBen/respec diff --git a/spec/approvals/cli/generated-script b/spec/approvals/cli/generated-script index 8e7ee14..8ceca03 100644 --- a/spec/approvals/cli/generated-script +++ b/spec/approvals/cli/generated-script @@ -50,22 +50,27 @@ _mygit_completions() { case "$compline" in 'status'*'--branch') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*'-b') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help" "--verbose" "--branch" "-b")" -- "$cur") ;; 'init'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur") ;; *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "-h" "-v" "--help" "--version" "init" "status")" -- "$cur") ;; diff --git a/spec/approvals/cli/generated-script-alt b/spec/approvals/cli/generated-script-alt index 23eb09b..e5ac987 100644 --- a/spec/approvals/cli/generated-script-alt +++ b/spec/approvals/cli/generated-script-alt @@ -50,22 +50,27 @@ _mycomps() { case "$compline" in 'status'*'--branch') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*'-b') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "--help" "--verbose" "--branch" "-b")" -- "$cur") ;; 'init'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mycomps_filter "--bare")" -- "$cur") ;; *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mycomps_filter "-h" "-v" "--help" "--version" "init" "status")" -- "$cur") ;; diff --git a/spec/approvals/cli/generated-wrapped-script b/spec/approvals/cli/generated-wrapped-script index 875142e..0770945 100644 --- a/spec/approvals/cli/generated-wrapped-script +++ b/spec/approvals/cli/generated-wrapped-script @@ -51,22 +51,27 @@ give_comps() { echo $'' echo $' case "$compline" in' echo $' \'status\'*\'--branch\')' - echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format=\'%(refname:short)\' 2>/dev/null)")" -- "$cur")' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' + echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format=\'%(refname:short)\' 2>/dev/null))" -- "$cur")' echo $' ;;' echo $'' echo $' \'status\'*\'-b\')' - echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format=\'%(refname:short)\' 2>/dev/null)")" -- "$cur")' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' + echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format=\'%(refname:short)\' 2>/dev/null))" -- "$cur")' echo $' ;;' echo $'' echo $' \'status\'*)' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help" "--verbose" "--branch" "-b")" -- "$cur")' echo $' ;;' echo $'' echo $' \'init\'*)' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur")' echo $' ;;' echo $'' echo $' *)' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "-h" "-v" "--help" "--version" "init" "status")" -- "$cur")' echo $' ;;' echo $'' diff --git a/spec/approvals/cli/test/completely-tester-1.sh b/spec/approvals/cli/test/completely-tester-1.sh index 7d141a9..eb591ef 100644 --- a/spec/approvals/cli/test/completely-tester-1.sh +++ b/spec/approvals/cli/test/completely-tester-1.sh @@ -58,22 +58,27 @@ _mygit_completions() { case "$compline" in 'status'*'--branch') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*'-b') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help" "--verbose" "--branch" "-b")" -- "$cur") ;; 'init'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur") ;; *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "-h" "-v" "--help" "--version" "init" "status")" -- "$cur") ;; diff --git a/spec/approvals/cli/test/completely-tester-2.sh b/spec/approvals/cli/test/completely-tester-2.sh index 73555b9..2fec8fe 100644 --- a/spec/approvals/cli/test/completely-tester-2.sh +++ b/spec/approvals/cli/test/completely-tester-2.sh @@ -58,22 +58,27 @@ _mygit_completions() { case "$compline" in 'status'*'--branch') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*'-b') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help" "--verbose" "--branch" "-b")" -- "$cur") ;; 'init'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur") ;; *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "-h" "-v" "--help" "--version" "init" "status")" -- "$cur") ;; diff --git a/spec/approvals/cli/test/completely-tester.sh b/spec/approvals/cli/test/completely-tester.sh index a3235d5..76c486e 100644 --- a/spec/approvals/cli/test/completely-tester.sh +++ b/spec/approvals/cli/test/completely-tester.sh @@ -58,22 +58,27 @@ _mygit_completions() { case "$compline" in 'status'*'--branch') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*'-b') - while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "$(git branch --format='%(refname:short)' 2>/dev/null)")" -- "$cur") + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions + while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter $(git branch --format='%(refname:short)' 2>/dev/null))" -- "$cur") ;; 'status'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "--help" "--verbose" "--branch" "-b")" -- "$cur") ;; 'init'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_mygit_completions_filter "--bare")" -- "$cur") ;; *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "-h" "-v" "--help" "--version" "init" "status")" -- "$cur") ;; diff --git a/spec/approvals/completions/function b/spec/approvals/completions/function index ffaa11c..788f661 100644 --- a/spec/approvals/completions/function +++ b/spec/approvals/completions/function @@ -51,14 +51,17 @@ send_completions() { echo $'' echo $' case "$compline" in' echo $' \'generate\'*)' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_completely_completions_filter "--help" "--force")" -- "$cur")' echo $' ;;' echo $'' echo $' \'init\'*)' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_completely_completions_filter "--help")" -- "$cur")' echo $' ;;' echo $'' echo $' *)' + echo $' # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions' echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_completely_completions_filter "--help" "--version" "init" "generate")" -- "$cur")' echo $' ;;' echo $'' diff --git a/spec/approvals/completions/script b/spec/approvals/completions/script index bb33f7b..1e34cc7 100644 --- a/spec/approvals/completions/script +++ b/spec/approvals/completions/script @@ -50,14 +50,17 @@ _completely_completions() { case "$compline" in 'generate'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_completely_completions_filter "--help" "--force")" -- "$cur") ;; 'init'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_completely_completions_filter "--help")" -- "$cur") ;; *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_completely_completions_filter "--help" "--version" "init" "generate")" -- "$cur") ;; diff --git a/spec/approvals/completions/script-complete-options b/spec/approvals/completions/script-complete-options index 8e6347c..f81438e 100644 --- a/spec/approvals/completions/script-complete-options +++ b/spec/approvals/completions/script-complete-options @@ -50,6 +50,7 @@ _mygit_completions() { case "$compline" in *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_mygit_completions_filter "status" "commit")" -- "$cur") ;; diff --git a/spec/approvals/completions/script-only-spaces b/spec/approvals/completions/script-only-spaces index f980115..9c7c7fa 100644 --- a/spec/approvals/completions/script-only-spaces +++ b/spec/approvals/completions/script-only-spaces @@ -50,10 +50,12 @@ _completely_completions() { case "$compline" in 'generate'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -W "$(_completely_completions_filter "--help" "--force")" -- "$cur") ;; 'init'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_completely_completions_filter "--help")" -- "$cur") ;; diff --git a/spec/completely/commands/generate_spec.rb b/spec/completely/commands/generate_spec.rb index 9d152ea..65eee8e 100644 --- a/spec/completely/commands/generate_spec.rb +++ b/spec/completely/commands/generate_spec.rb @@ -22,12 +22,12 @@ expect(File.read 'completely.bash').to match_approval('cli/generated-script') end - it 'generates a shellcheck compliant script' do + it 'generates a shellcheck compliant script', :script_quality do expect { subject.execute %w[generate] }.to output_approval('cli/generate/no-args') expect(`shellcheck completely.bash 2>&1`).to be_empty end - it 'generates a shfmt compliant script' do + it 'generates a shfmt compliant script', :script_quality do expect { subject.execute %w[generate] }.to output_approval('cli/generate/no-args') expect(`shfmt -d -i 2 -ci completely.bash 2>&1`).to be_empty end diff --git a/spec/completely/integration.yml b/spec/completely/integration.yml index eb90815..05f3b53 100644 --- a/spec/completely/integration.yml +++ b/spec/completely/integration.yml @@ -9,7 +9,7 @@ ftp: expected: [download] - compline: "ftp download " - expected: [another-dir, dir with spaces, dummy-dir, file with spaces.txt, ftp.yaml, gradual.yaml, wildcard.yaml] + expected: [another-dir, dir with spaces, dummy-dir, dynamic.txt, dynamic.yaml, file with spaces.txt, ftp.yaml, gradual.yaml, wildcard.yaml] - compline: "ftp download -" expected: [--help, --override] @@ -29,6 +29,16 @@ ftp: - compline: "/anything/goes/ftp list -" expected: [--help, --short] +dynamic: +- compline: "dynamic " + expected: [foo bar, hello, help] + +- compline: "dynamic h" + expected: [hello, help] + +- compline: "dynamic f" + expected: [foo bar] + gradual: - compline: "cli " expected: [command, conquer] @@ -93,4 +103,3 @@ wildcard: - compline: "wildcard download --contest " expected: [everything, nothing] - diff --git a/spec/fixtures/integration/dynamic.txt b/spec/fixtures/integration/dynamic.txt new file mode 100644 index 0000000..da2146a --- /dev/null +++ b/spec/fixtures/integration/dynamic.txt @@ -0,0 +1,2 @@ +hello +help diff --git a/spec/fixtures/integration/dynamic.yaml b/spec/fixtures/integration/dynamic.yaml new file mode 100644 index 0000000..c677ab1 --- /dev/null +++ b/spec/fixtures/integration/dynamic.yaml @@ -0,0 +1,3 @@ +dynamic: +- $(cat dynamic.txt) +- foo bar diff --git a/spec/fixtures/tester/default.bash b/spec/fixtures/tester/default.bash index c4df327..2b843ca 100644 --- a/spec/fixtures/tester/default.bash +++ b/spec/fixtures/tester/default.bash @@ -50,18 +50,22 @@ _cli_completions() { case "$compline" in 'command childcommand'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--quiet" "--verbose" "-q" "-v")" -- "$cur") ;; 'command subcommand'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--force" "--quiet")" -- "$cur") ;; 'command'*) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "subcommand" "childcommand")" -- "$cur") ;; *) + # shellcheck disable=SC2046 # intentional splitting for dynamic $(...) completions while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help" "--version" "command" "conquer")" -- "$cur") ;;