diff options
-rw-r--r-- | CREDITS | 2 | ||||
-rw-r--r-- | Makefile | 33 | ||||
-rw-r--r-- | README | 17 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | completion/bash-completion.sh | 18 | ||||
-rw-r--r-- | completion/fish-completion.fish | 24 | ||||
-rwxr-xr-x | ponysay | 6 |
7 files changed, 93 insertions, 17 deletions
@@ -7,10 +7,10 @@ Sven-Hendrik Haase Jan Alexander Steffens # Patchers and other contributors +Elis Axelsson Duane Bekaert Pablo Lezaeta Kyah Rindlisbacher James Ross-Gowan Louis Taylor -Elis Jannis @@ -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,11 +41,17 @@ install: all install "ponysaylist.pl" "$(DESTDIR)/usr/bin/ponysaylist.pl" ln -sf "ponysay" "$(DESTDIR)/usr/bin/ponythink" - 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/bash-completion-think.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponythink" + + mkdir -p "$(DESTDIR)/usr/share/fish/completions/" + 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" + 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" @@ -78,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" @@ -89,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" @@ -35,7 +35,9 @@ Required runtime dependencies Optional runtime dependencies ============================= - (none) + ponyquotes4ponysay : for support of My Little Pony quotes with associated pony + -- Available for Arch:ers in AUR (https://aur.archlinux.org/packages.php?ID=60988) + -- and on github at https://github.com/maandree/ponyquotes4ponysay Package building dependencies @@ -110,6 +112,19 @@ Pony fortune on terminal startup https://aur.archlinux.org/packages.php?ID=60229 +Pony quotes +=========== + +Installing ponyquotes4ponysay will enable My Little Pony quotes with associated pony. +It is available at: https://github.com/maandree/ponyquotes4ponysay + https://aur.archlinux.org/packages.php?ID=60988 + +Run `ponysay -q` will give you a random pony saying one it its quote from MLP:FiM. +Add one or more argument after `-q` to sepcify a set of ponies from which one will be selected randomly. + +When running `ponysay -l` or `ponysay -L` the ponies which have quotes will be printed bold or bright (depending on terminal + + Ponies in TTY (Linux VT) ======================== @@ -45,6 +45,16 @@ Edit your `~/.bashrc` and add this to the end of the file Now every time you open a terminal a pony should give your fortune +### Pony quotes + +Installing [ponyquotes4ponysay](https://github.com/maandree/ponyquotes4ponysay) will enable My Little Pony quotes with associated pony. + +Run `ponysay -q` will give you a random pony saying one it its quote from MLP:FiM. Add one or more argument after `-q` to sepcify a +set of ponies from which one will be selected randomly. + +When running `ponysay -l` or `ponysay -L` the ponies which have quotes will be printed bold or bright (depending on terminal). + + ### Ponies in TTY (Linux VT) If you have a custom colour palette edit your `~/.bashrc` and add diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index 82eb608..53c53ef 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -5,16 +5,22 @@ _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=() 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 @@ -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 } 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 <etu AT elis DOT nu> + + +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 + @@ -2,13 +2,13 @@ version=1.0 SYSTEMPONIES="/usr/share/ponysay/ponies" -HOMEPONIES="${HOME}/.ponysay/ponies" +HOMEPONIES="${HOME}/.local/share/ponysay/ponies" pony="*" wrap="" if [ "$TERM" = "linux" ]; then SYSTEMPONIES="/usr/share/ponysay/ttyponies" - HOMEPONIES="${HOME}/.ponysay/ttyponies" + HOMEPONIES="${HOME}/.local/share/ponysay/ttyponies" fi cmd=cowsay @@ -19,7 +19,7 @@ version() { } scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` -listcmd="$0list.pl" +listcmd="ponysaylist.pl" haspq=1 if [[ -f './pq4ps-list' ]]; then |