diff options
author | Nevo Hed <nhed-debianorg15@bsoftworks.com> | 2016-02-08 16:38:32 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2016-02-08 16:38:32 +0200 |
commit | 39acdb21e89f89c207089da4c061c193d5d8af84 (patch) | |
tree | e3b935a9bfd5c758955fb9395b64644cf9c4efbb | |
parent | 9cbd68becbd728d5fda88a6f456c4c72eac92ec8 (diff) | |
download | bash-completion-39acdb21e89f89c207089da4c061c193d5d8af84.tar.gz |
minicom: Recognize user ~/.minirc.* as config files
minicom can be started with certain flag and an optional config
CFGNAME where CFGNAME matches a minirc.CFGNAME in a system dir or a
.minirc.CFGNAME in users home dir. The current implementation only
checks system paths, the attached patch removes the exclusivity of any
of the possible directories and returns the config names from system
or home directory.
-rw-r--r-- | completions/minicom | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/completions/minicom b/completions/minicom index d168ce44..2f1db266 100644 --- a/completions/minicom +++ b/completions/minicom @@ -28,15 +28,11 @@ _minicom() -T -7 -8' -- "$cur" ) ) return 0 else - local confdir - [[ -n $( command ls /etc/minirc.* 2>/dev/null ) ]] && confdir=/etc - [[ -n $( command ls /etc/minicom/minirc.* 2>/dev/null ) ]] \ - && confdir=/etc/minicom - if [[ -n $confdir ]]; then - COMPREPLY=( $( compgen -W '$( printf "%s\n" $confdir/minirc.* | \ - sed -e "s|$confdir/minirc.||")' -- "$cur" ) ) - return 0 - fi + COMPREPLY=( + $( command ls /etc/minirc.* /etc/minicom/minirc.* ~/.minirc.* \ + 2>/dev/null | sed 's|^.*minirc\.||' | \ + grep "^${cur}" ) ) + [[ $COMPREPLY ]] && return fi } && complete -F _minicom -o default minicom |