Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clap_complete/src/aot/shells/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Generator for Bash {
cmd=\"\"
opts=\"\"

for i in ${{COMP_WORDS[@]}}
for i in \"${{COMP_WORDS[@]:0:COMP_CWORD}}\"
do
case \"${{cmd}},${{i}}\" in
\",$1\")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/aliases.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/basic.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/custom_bin_name.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _bin-name() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/feature_sample.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _exhaustive() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/quoting.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/special_commands.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/sub_subcommands.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/subcommand_last.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/value_hint.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
2 changes: 1 addition & 1 deletion clap_complete/tests/snapshots/value_terminator.bash
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _my-app() {
cmd=""
opts=""

for i in ${COMP_WORDS[@]}
for i in "${COMP_WORDS[@]:0:COMP_CWORD}"
do
case "${cmd},${i}" in
",$1")
Expand Down
18 changes: 18 additions & 0 deletions clap_complete/tests/testsuite/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ another shell bash fish zsh
let actual = runtime.complete(input, &term).unwrap();
assert_data_eq!(actual, expected);

// Trigger completion immediately after "--"
let input = "exhaustive -- hint\x1b[D\x1b[D\x1b[D\x1b[D\x1b[D\t\t";
let expected = snapbox::str![[r#"
%
--generate --empty-choice --help
"#]];
let actual = runtime.complete(input, &term).unwrap();
assert_data_eq!(actual, expected);

{
use std::fs::File;
use std::path::Path;
Expand Down Expand Up @@ -449,6 +458,15 @@ fn complete_dynamic_middle_of_word() {
let expected = snapbox::str![[r#"
%
another shell bash fish zsh
"#]];
let actual = runtime.complete(input, &term).unwrap();
assert_data_eq!(actual, expected);

// Trigger completion immediately after "--"
let input = "exhaustive -- hint\x1b[D\x1b[D\x1b[D\x1b[D\x1b[D\t\t";
let expected = snapbox::str![[r#"
%
--generate --empty-choice --help
"#]];
let actual = runtime.complete(input, &term).unwrap();
assert_data_eq!(actual, expected);
Expand Down