File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed
home/dynamic-env/exhaustive/bash Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change @@ -380,3 +380,20 @@ fn complete_dynamic_empty_option_value() {
380380 let actual = runtime. complete ( input, & term) . unwrap ( ) ;
381381 assert_data_eq ! ( actual, expected) ;
382382}
383+
384+ #[ test]
385+ #[ cfg( all( unix, feature = "unstable-dynamic" ) ) ]
386+ #[ cfg( feature = "unstable-shell-tests" ) ]
387+ fn complete_dynamic_dir_no_trailing_space ( ) {
388+ if !common:: has_command ( CMD ) {
389+ return ;
390+ }
391+
392+ let term = completest:: Term :: new ( ) ;
393+ let mut runtime = common:: load_runtime :: < RuntimeBuilder > ( "dynamic-env" , "exhaustive" ) ;
394+
395+ let input = "exhaustive hint --file test\t " ;
396+ let expected = snapbox:: str![ "exhaustive hint --file test % exhaustive hint --file tests/" ] ;
397+ let actual = runtime. complete ( input, & term) . unwrap ( ) ;
398+ assert_data_eq ! ( actual, expected) ;
399+ }
You can’t perform that action at this time.
0 commit comments