From 5f672bb9f76f0c37563202cfd9ed9755633a7050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Thu, 19 Jul 2012 18:26:19 +0200 Subject: [PATCH 1/2] m manuals --- completion/bash-completion.sh | 4 ++-- completion/fish_ponysay.fish | 4 ++-- completion/fish_ponythink.fish | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index e1198343..53c53efa 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 f0c73a25..ea98382c 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 928b72eb..24391ce8 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" From 839f0b20e8e4982da6a152bd6d702b699d352324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Andr=C3=A9e?= Date: Thu, 19 Jul 2012 18:43:33 +0200 Subject: [PATCH 2/2] autogeneration of ponythink shell completions from ponysay completions --- Makefile | 33 ++++++++++++++----- ...fish_ponysay.fish => fish-completion.fish} | 0 completion/fish_ponythink.fish | 24 -------------- 3 files changed, 24 insertions(+), 33 deletions(-) rename completion/{fish_ponysay.fish => fish-completion.fish} (100%) delete mode 100644 completion/fish_ponythink.fish diff --git a/Makefile b/Makefile index 860d1326..37883a62 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: ponysaytruncater manpages +all: ponysaytruncater manpages ponythinkcompletion ponysaytruncater: @@ -10,6 +10,12 @@ manpages: gzip -9 < manuals/manpage.es.6 > manuals/manpage.es.6.gz +ponythinkcompletion: + sed -e 's/ponysay/ponythink/g' <"completion/bash-completion.sh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/bash-completion-think.sh" + sed -e 's/ponysay/ponythink/g' <"completion/fish-completion.fish" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/fish-completion-think.fish" + sed -e 's/ponysay/ponythink/g' <"completion/zsh-completion.zsh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/zsh-completion-think.zsh" + + ttyponies: mkdir -p ttyponies for pony in $$(ls --color=no ponies/); do \ @@ -35,15 +41,17 @@ install: all install "ponysaylist.pl" "$(DESTDIR)/usr/bin/ponysaylist.pl" ln -sf "ponysay" "$(DESTDIR)/usr/bin/ponythink" + mkdir -p "$(DESTDIR)/usr/share/bash-completion/completions/" + install "completion/bash-completion.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponysay" + install "completion/bash-completion-think.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponythink" + mkdir -p "$(DESTDIR)/usr/share/fish/completions/" - install -m "644" "completion/fish_ponysay.fish" "$(DESTDIR)/usr/share/fish/completions/ponysay.fish" - install -m "644" "completion/fish_ponythink.fish" "$(DESTDIR)/usr/share/fish/completions/ponythink.fish" + install "completion/fish-completion.fish" "$(DESTDIR)/usr/share/fish/completions/ponysay.fish" + install "completion/fish-completion-think.fish" "$(DESTDIR)/usr/share/fish/completions/ponythink.fish" mkdir -p "$(DESTDIR)/usr/share/zsh/site-functions/" install "completion/zsh-completion.zsh" "$(DESTDIR)/usr/share/zsh/site-functions/_ponysay" - - mkdir -p "$(DESTDIR)/usr/share/bash-completion/completions/" - install "completion/bash-completion.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponysay" + install "completion/zsh-completion-think.zsh" "$(DESTDIR)/usr/share/zsh/site-functions/_ponythink" mkdir -p "$(DESTDIR)/usr/share/licenses/ponysay/" install "COPYING" "$(DESTDIR)/usr/share/licenses/ponysay/COPYING" @@ -82,9 +90,13 @@ uninstall: unlink "$(DESTDIR)/usr/bin/ponysaylist.pl" unlink "$(DESTDIR)/usr/bin/ponysaytruncater" unlink "$(DESTDIR)/usr/bin/ponythink" - unlink "$(DESTDIR)/usr/share/zsh/site-functions/_ponysay"; unlink "$(DESTDIR)/usr/share/licenses/ponysay/COPYING" unlink "$(DESTDIR)/usr/share/bash-completion/completions/ponysay" + unlink "$(DESTDIR)/usr/share/bash-completion/completions/ponythink" + unlink "$(DESTDIR)/usr/share/fish/completions/ponysay.fish" + unlink "$(DESTDIR)/usr/share/fish/completions/ponythink.fish" + unlink "$(DESTDIR)/usr/share/zsh/site-functions/_ponysay"; + unlink "$(DESTDIR)/usr/share/zsh/site-functions/_ponythink"; unlink "$(DESTDIR)/usr/share/man/man6/ponysay.6.gz" unlink "$(DESTDIR)/usr/share/man/man6/ponythink.6.gz" unlink "$(DESTDIR)/usr/share/man/es/man6/ponysay.6.gz" @@ -93,6 +105,9 @@ uninstall: clean: rm -f "ponysaytruncater" - rm manuals/manpage.6.gz - rm manuals/manpage.es.6.gz + rm "completion/bash-completion-think.sh" + rm "completion/fish-completion-think.fish" + rm "completion/zsh-completion-think.zsh" + rm "manuals/manpage.6.gz" + rm "manuals/manpage.es.6.gz" diff --git a/completion/fish_ponysay.fish b/completion/fish-completion.fish similarity index 100% rename from completion/fish_ponysay.fish rename to completion/fish-completion.fish diff --git a/completion/fish_ponythink.fish b/completion/fish_ponythink.fish deleted file mode 100644 index 24391ce8..00000000 --- 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 -