From f6c9058590d1ce018f37e5f63bcf5d66b093250f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 19 Jul 2012 04:32:35 +0200 Subject: bash completion dependency reduction and update --- completion/bash-completion.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'completion') diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index 82eb608..e119834 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -5,7 +5,13 @@ _ponysay() local cur prev words cword _init_completion -n = || return - COMPREPLY=( $( compgen -W '-v -h -l -f -W' -- "$cur" ) ) + quotes=$(pq4ps --list 2>/dev/null) + quotesexit=$? + options='-v -h -l -f -W' + if [[ $quotesexit = 0 ]]; then + options="$options -q" + fi + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) if [[ $prev = "-f" ]]; then COMPREPLY=() @@ -24,8 +30,10 @@ _ponysay() COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) ) fi elif [[ $prev = "-W" ]]; then - cols=$( echo `tput cols` - 10 | bc ) - COMPREPLY=( $cols $( echo $cols / 2 | bc ) 100 60 ) + cols=$(( `stty size | cut -d ' ' -f 2` - 10 )) + COMPREPLY=( $cols $(( $cols / 2 )) 100 60 ) + elif [[ $quotesexit = 0 ]] && [[ $prev = "-q" ]]; then + COMPREPLY=( $( compgen -W "$quotes" -- "$cur" ) ) fi } -- cgit From bae75d95b6ce3af5ac16284a6079ba0feb65cf0b Mon Sep 17 00:00:00 2001 From: Elis Axelsson Date: Thu, 19 Jul 2012 14:56:43 +0200 Subject: Added completions for the fish and fishfish(a fork of fish) shell --- completion/fish_ponysay.fish | 24 ++++++++++++++++++++++++ completion/fish_ponythink.fish | 24 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 completion/fish_ponysay.fish create mode 100644 completion/fish_ponythink.fish (limited to 'completion') diff --git a/completion/fish_ponysay.fish b/completion/fish_ponysay.fish new file mode 100644 index 0000000..f0c73a2 --- /dev/null +++ b/completion/fish_ponysay.fish @@ -0,0 +1,24 @@ + +# Completions for ponysay & ponythink +# https://github.com/erkin/ponysay/ +# +# Author: Elis Axelsson + + +if test -d /usr/share/ponysay/ponies/ + set -g systemponies (ls /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') +end + +if test -d ~/.local/share/ponysay/ponies/ + set -g homeponies (ls ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') +end + +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 f -a "$systemponies $homeponies" --description "Select a pony, either a filename or pony name" +complete -c ponysay -s W -a "Integer" --description "The screen column where the message should be wrapped" + +set -e systemponies +set -e homeponies + diff --git a/completion/fish_ponythink.fish b/completion/fish_ponythink.fish new file mode 100644 index 0000000..928b72e --- /dev/null +++ b/completion/fish_ponythink.fish @@ -0,0 +1,24 @@ + +# Completions for ponysay & ponythink +# https://github.com/erkin/ponysay/ +# +# Author: Elis Axelsson + + +if test -d /usr/share/ponysay/ponies/ + set -g systemponies (ls /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') +end + +if test -d ~/.local/share/ponysay/ponies/ + set -g homeponies (ls ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') +end + +complete -c ponythink -s h --description "Help of ponythink" +complete -c ponythink -s v --description "Version of ponythink" +complete -c ponythink -s l --description "List pony files" +complete -c ponythink -s f -a "$systemponies $homeponies" --description "Select a pony, either a filename or pony name" +complete -c ponythink -s W -a "Integer" --description "The screen column where the message should be wrapped" + +set -e systemponies +set -e homeponies + -- cgit From 5f672bb9f76f0c37563202cfd9ed9755633a7050 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 19 Jul 2012 18:26:19 +0200 Subject: m manuals --- completion/bash-completion.sh | 4 ++-- completion/fish_ponysay.fish | 4 ++-- completion/fish_ponythink.fish | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'completion') diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index e119834..53c53ef 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -17,10 +17,10 @@ _ponysay() COMPREPLY=() sysponies=/usr/share/ponysay/ponies/ - usrponies=~/.ponies/ + usrponies=~/.local/share/ponysay/ponies/ if [[ $TERM = "linux" ]]; then sysponies=/usr/share/ponysay/ttyponies/ - usrponies=~/.ttyponies/ + usrponies=~/.local/share/ponysay/ttyponies/ fi if [[ -d $sysponies ]]; then diff --git a/completion/fish_ponysay.fish b/completion/fish_ponysay.fish index f0c73a2..ea98382 100644 --- a/completion/fish_ponysay.fish +++ b/completion/fish_ponysay.fish @@ -6,11 +6,11 @@ if test -d /usr/share/ponysay/ponies/ - set -g systemponies (ls /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') + set -g systemponies (ls --color=no /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') end if test -d ~/.local/share/ponysay/ponies/ - set -g homeponies (ls ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') + set -g homeponies (ls --color=no ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') end complete -c ponysay -s h --description "Help of ponysay" diff --git a/completion/fish_ponythink.fish b/completion/fish_ponythink.fish index 928b72e..24391ce 100644 --- a/completion/fish_ponythink.fish +++ b/completion/fish_ponythink.fish @@ -6,11 +6,11 @@ if test -d /usr/share/ponysay/ponies/ - set -g systemponies (ls /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') + set -g systemponies (ls --color=no /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') end if test -d ~/.local/share/ponysay/ponies/ - set -g homeponies (ls ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') + set -g homeponies (ls --color=no ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') end complete -c ponythink -s h --description "Help of ponythink" -- cgit From 839f0b20e8e4982da6a152bd6d702b699d352324 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 19 Jul 2012 18:43:33 +0200 Subject: autogeneration of ponythink shell completions from ponysay completions --- completion/fish-completion.fish | 24 ++++++++++++++++++++++++ completion/fish_ponysay.fish | 24 ------------------------ completion/fish_ponythink.fish | 24 ------------------------ 3 files changed, 24 insertions(+), 48 deletions(-) create mode 100644 completion/fish-completion.fish delete mode 100644 completion/fish_ponysay.fish delete mode 100644 completion/fish_ponythink.fish (limited to 'completion') diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish new file mode 100644 index 0000000..ea98382 --- /dev/null +++ b/completion/fish-completion.fish @@ -0,0 +1,24 @@ + +# Completions for ponysay & ponythink +# https://github.com/erkin/ponysay/ +# +# Author: Elis Axelsson + + +if test -d /usr/share/ponysay/ponies/ + set -g systemponies (ls --color=no /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') +end + +if test -d ~/.local/share/ponysay/ponies/ + set -g homeponies (ls --color=no ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') +end + +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 f -a "$systemponies $homeponies" --description "Select a pony, either a filename or pony name" +complete -c ponysay -s W -a "Integer" --description "The screen column where the message should be wrapped" + +set -e systemponies +set -e homeponies + diff --git a/completion/fish_ponysay.fish b/completion/fish_ponysay.fish deleted file mode 100644 index ea98382..0000000 --- a/completion/fish_ponysay.fish +++ /dev/null @@ -1,24 +0,0 @@ - -# Completions for ponysay & ponythink -# https://github.com/erkin/ponysay/ -# -# Author: Elis Axelsson - - -if test -d /usr/share/ponysay/ponies/ - set -g systemponies (ls --color=no /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') -end - -if test -d ~/.local/share/ponysay/ponies/ - set -g homeponies (ls --color=no ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') -end - -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 f -a "$systemponies $homeponies" --description "Select a pony, either a filename or pony name" -complete -c ponysay -s W -a "Integer" --description "The screen column where the message should be wrapped" - -set -e systemponies -set -e homeponies - diff --git a/completion/fish_ponythink.fish b/completion/fish_ponythink.fish deleted file mode 100644 index 24391ce..0000000 --- a/completion/fish_ponythink.fish +++ /dev/null @@ -1,24 +0,0 @@ - -# Completions for ponysay & ponythink -# https://github.com/erkin/ponysay/ -# -# Author: Elis Axelsson - - -if test -d /usr/share/ponysay/ponies/ - set -g systemponies (ls --color=no /usr/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from \/usr\/share\/ponysay\/ponies\//') -end - -if test -d ~/.local/share/ponysay/ponies/ - set -g homeponies (ls --color=no ~/.local/share/ponysay/ponies/ | sed 's/\.pony/\t Pony from ~\/.local\/share\/ponysay\/ponies\//') -end - -complete -c ponythink -s h --description "Help of ponythink" -complete -c ponythink -s v --description "Version of ponythink" -complete -c ponythink -s l --description "List pony files" -complete -c ponythink -s f -a "$systemponies $homeponies" --description "Select a pony, either a filename or pony name" -complete -c ponythink -s W -a "Integer" --description "The screen column where the message should be wrapped" - -set -e systemponies -set -e homeponies - -- cgit