diff --git a/completions/java b/completions/java index 526269b29e1..3494d7ebc8c 100644 --- a/completions/java +++ b/completions/java @@ -81,11 +81,11 @@ _comp_cmd_java__classes() fi elif [[ -d $i ]]; then - COMPREPLY+=( - $(compgen -d -- "$i/$cur" | command sed -e "s|^$i/\(.*\)|\1.|") - $(compgen -f -X '!*.class' -- "$i/$cur" | - command sed -e '/\$/d' -e "s|^$i/||") - ) + local tmp + _comp_compgen -v tmp -c "$i/$cur" -- -d -S . + _comp_compgen -av tmp -c "$i/$cur" -- -f -X '!*.class' + ((${#tmp[@]})) && + _comp_compgen -a -- -X '*\$*' -W '"${tmp[@]#$i/}"' [[ ${COMPREPLY-} == *.class ]] || compopt -o nospace # FIXME: if we have foo.class and foo/, the completion diff --git a/completions/kldload b/completions/kldload index be428a55061..d842b669c4d 100644 --- a/completions/kldload +++ b/completions/kldload @@ -18,11 +18,11 @@ _comp_cmd_kldload() compopt -o filenames for i in "${moddirs[@]}"; do - modules=($(compgen -f "$i/$cur")) - modules=(${modules[@]#$i/}) - COMPREPLY+=("${modules[@]}") + _comp_compgen -v modules -c "$i/$cur" -- -f && + COMPREPLY+=("${modules[@]#$i/}") done - COMPREPLY=(${COMPREPLY[@]%.ko}) + ((${#COMPREPLY[@]})) && + COMPREPLY=("${COMPREPLY[@]%.ko}") # also add dirs in current dir _comp_compgen -a filedir -d