diff --git a/completions/bash/exa b/completions/bash/exa index 5340686..187efe0 100644 --- a/completions/bash/exa +++ b/completions/bash/exa @@ -30,8 +30,17 @@ _exa() esac case "$cur" in + # _parse_help doesn’t pick up short options when they are on the same line than long options + --*) + # colo[u]r isn’t parsed correctly so we filter these options out and add them by hand + parse_help=$( exa --help | grep -oE ' (\-\-[[:alnum:]@-]+)' | tr -d ' ' | grep -v '\-\-colo' ) + completions=$( echo '--color --colour --color-scale --colour-scale' $parse_help ) + COMPREPLY=( $( compgen -W "$completions" -- "$cur" ) ) + ;; + -*) - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + completions=$( exa --help | grep -oE ' (\-[[:alnum:]@])' | tr -d ' ' ) + COMPREPLY=( $( compgen -W "$completions" -- "$cur" ) ) ;; *)