Skip to content

Commit fd3f6d2

Browse files
committed
fix(complete): Restore nospace in bash
1 parent 2f6a108 commit fd3f6d2

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

clap_complete/src/env/shells.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ _clap_complete_NAME() {
4141
_CLAP_IFS="$IFS" \
4242
_CLAP_COMPLETE_INDEX="$_CLAP_COMPLETE_INDEX" \
4343
_CLAP_COMPLETE_COMP_TYPE="$_CLAP_COMPLETE_COMP_TYPE" \
44+
_CLAP_COMPLETE_SPACE="$_CLAP_COMPLETE_SPACE" \
4445
VAR="bash" \
4546
"COMPLETER" -- "${COMP_WORDS[@]}" \
4647
) )
4748
if [[ $? != 0 ]]; then
4849
unset COMPREPLY
49-
elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then
50+
elif [[ $_CLAP_COMPLETE_SPACE == false ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then
5051
compopt -o nospace
5152
fi
5253
}

clap_complete/tests/snapshots/home/dynamic-env/exhaustive/bash/.bashrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ _clap_complete_exhaustive() {
1414
_CLAP_IFS="$IFS" \
1515
_CLAP_COMPLETE_INDEX="$_CLAP_COMPLETE_INDEX" \
1616
_CLAP_COMPLETE_COMP_TYPE="$_CLAP_COMPLETE_COMP_TYPE" \
17+
_CLAP_COMPLETE_SPACE="$_CLAP_COMPLETE_SPACE" \
1718
COMPLETE="bash" \
1819
"exhaustive" -- "${COMP_WORDS[@]}" \
1920
) )
2021
if [[ $? != 0 ]]; then
2122
unset COMPREPLY
22-
elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then
23+
elif [[ $_CLAP_COMPLETE_SPACE == false ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then
2324
compopt -o nospace
2425
fi
2526
}

clap_complete/tests/snapshots/register_minimal.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ _clap_complete_my_app() {
1717
) )
1818
if [[ $? != 0 ]]; then
1919
unset COMPREPLY
20-
elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then
20+
elif [[ $_CLAP_COMPLETE_SPACE == false ]] && [[ "${COMPREPLY-}" =~ [=/:]$ ]]; then
2121
compopt -o nospace
2222
fi
2323
}

clap_complete/tests/testsuite/bash.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ fn complete_dynamic_empty_option_value() {
384384
#[test]
385385
#[cfg(all(unix, feature = "unstable-dynamic"))]
386386
#[cfg(feature = "unstable-shell-tests")]
387-
fn complete_dynamic_dir_trailing_space() {
387+
fn complete_dynamic_dir_no_trailing_space() {
388388
if !common::has_command(CMD) {
389389
return;
390390
}
@@ -393,7 +393,7 @@ fn complete_dynamic_dir_trailing_space() {
393393
let mut runtime = common::load_runtime::<RuntimeBuilder>("dynamic-env", "exhaustive");
394394

395395
let input = "exhaustive hint --file test\t";
396-
let expected = snapbox::str!["exhaustive hint --file test % exhaustive hint --file tests/ "];
396+
let expected = snapbox::str!["exhaustive hint --file test % exhaustive hint --file tests/"];
397397
let actual = runtime.complete(input, &term).unwrap();
398398
assert_data_eq!(actual, expected);
399399
}

0 commit comments

Comments
 (0)