X-Git-Url: http://git.tuebingen.mpg.de/?p=gsu.git;a=blobdiff_plain;f=subcommand;fp=subcommand;h=f269cdb6197b94ae6df687ce44115e6cc43825dd;hp=956fb5c865ad3ae780ac7344917345879380aa8e;hb=e6023baff6bf935450059d158fc5697f7aadf5d7;hpb=46d356bc055978057542e999892ec6e0cf1c0153 diff --git a/subcommand b/subcommand index 956fb5c..f269cdb 100644 --- a/subcommand +++ b/subcommand @@ -739,7 +739,12 @@ com_complete() local -a candidates; candidates=(\$($0 complete "\$COMP_CWORD" "\${COMP_WORDS[@]}")); - COMPREPLY=(\$(compgen -W "\${candidates[*]}" -- "\$cur")); + if ((\$? == 0)); then + COMPREPLY=(\$(compgen -W "\${candidates[*]}" -- "\$cur")); + else + compopt -o filenames; + COMPREPLY=(\$(compgen -fd -- "\$cur")); + fi EOF ret=$GSU_SUCCESS return @@ -757,8 +762,9 @@ EOF shift words=("$@") cmd="${words[1]}" - ret=$GSU_SUCCESS # It's not an error if no completer was defined - [[ "$(type -t "complete_$cmd")" != "function" ]] && return + # if no completer is defined for this subcommand we exit unsuccessfully + # to let the generic completer above fall back to file name completion. + [[ "$(type -t "complete_$cmd")" != "function" ]] && exit 1 "complete_$cmd" "$cword" "${words[@]}" # ignore errors, they would only clutter the completion output ret=$GSU_SUCCESS