aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-18 02:34:54 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-18 02:34:54 +0200
commite868a2340093ec8fd3c77466b097ddbaf040875a (patch)
tree2b0733d3044831d81e95ef4bbfb3391ef86d448d
parent532ab6c6ee1e529cc98e4d85cd27d5664d2752ac (diff)
downloadponysay-e868a2340093ec8fd3c77466b097ddbaf040875a.tar.gz
ponysay-e868a2340093ec8fd3c77466b097ddbaf040875a.tar.bz2
ponysay-e868a2340093ec8fd3c77466b097ddbaf040875a.zip
bash and fish completion knowns which ponies have quotes
-rw-r--r--completion/bash-completion.sh21
-rw-r--r--completion/fish-completion.fish10
2 files changed, 20 insertions, 11 deletions
diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh
index 472bcb0..26e1134 100644
--- a/completion/bash-completion.sh
+++ b/completion/bash-completion.sh
@@ -8,7 +8,7 @@ _ponysay()
options='-v -h -l -f -W -q'
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
- if [[ $prev = "-f" ]]; then
+ if [ $prev = "-f" ]; then
COMPREPLY=()
sysponies=/usr/share/ponysay/ponies/
@@ -18,17 +18,18 @@ _ponysay()
usrponies=~/.local/share/ponysay/ttyponies/
fi
- if [[ -d $sysponies ]]; then
- COMPREPLY+=( $( compgen -W "$(ls --color=no $sysponies | sed -e 's/.pony//g')" -- "$cur" ) )
- fi
- if [[ -d $usrponies ]]; then
- COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) )
- fi
- elif [[ $prev = "-W" ]]; then
+ [ -d $sysponies ] && COMPREPLY+=( $( compgen -W "$(ls --color=no $sysponies | sed -e 's/.pony//g')" -- "$cur" ) )
+ [ -d $usrponies ] && COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) )
+
+ elif [ $prev = "-W" ]; then
cols=$(( `stty size | cut -d ' ' -f 2` - 10 ))
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 )
- elif [[ $prev = "-q" ]]; then
- COMPREPLY=( $( compgen -W "$quotes" -- "$cur" ) )
+
+ elif [ $prev = "-q" ]; then
+ qcmd=/usr/lib/ponysay/pq4ps
+ quoters=$($qcmd -l)
+ COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
+
fi
}
diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish
index 1339cf6..89f7a19 100644
--- a/completion/fish-completion.fish
+++ b/completion/fish-completion.fish
@@ -21,17 +21,25 @@ if test -d $homepath
end
+set -g qcmd /usr/lib/ponysay/pq4ps
+set -g quoters ($qcmd -l)
+
+
complete -c ponysay -s h --description "Help of ponysay"
complete -c ponysay -s v --description "Version of ponysay"
complete -c ponysay -s l --description "List pony files"
complete -c ponysay -s L --description "List pony files with alternatives"
complete -c ponysay -s f -a "$homeponies $systemponies" --description "Select a pony"
-complete -c ponysay -s q -a "$homeponies $systemponies" --description "Select ponies for MLP:FiM quotes"
+complete -c ponysay -s q -a "$quoters" --description "Select ponies for MLP:FiM quotes"
complete -c ponysay -s W -a "Integer" --description "The screen column where the message should be wrapped"
set -e systempath
set -e homepath
+
set -e systemponies
set -e homeponies
+set -e qcmd
+set -e quoters
+