summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNevo Hed <nhed-debianorg15@bsoftworks.com>2016-02-08 16:38:32 +0200
committerVille Skyttä <ville.skytta@iki.fi>2016-02-08 16:38:32 +0200
commit39acdb21e89f89c207089da4c061c193d5d8af84 (patch)
treee3b935a9bfd5c758955fb9395b64644cf9c4efbb
parent9cbd68becbd728d5fda88a6f456c4c72eac92ec8 (diff)
downloadbash-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/minicom14
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