Skip to content

Commit 12706cf

Browse files
committed
Better bash autocompletion for directory options
Bash autocomplete adds trailing slash for directories and handle correctly directories named with spaces. Signed-off-by: Pedro Rabello Sato <[email protected]>
1 parent 968d5e8 commit 12706cf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

completions/bash/distrobox

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ _generate_from_help() {
1919
fileopts="--file"
2020

2121
if [[ ${prev} =~ ${diropts} ]]; then
22-
COMPREPLY=($(compgen -d -- ${cur}))
22+
COMPREPLY=($(IFS=$'\n'; realpath $(compgen -d -- ${cur}) 2>/dev/null))
23+
compopt -o filenames
2324
return 0
2425
fi
2526

0 commit comments

Comments
 (0)