From 13308a6880608454906ac2f1d87a8e39f87ef48c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 25 Oct 2012 02:36:35 +0200 Subject: enable --F and --f without argument, this way you can get any random extrapony by ending the commmand line with just --F --- manuals/ponysay.texinfo | 3 +++ ponysay.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index fd34717..703719e 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -216,6 +216,9 @@ Variadic variant of @option{-F}, meaning that all arguments added after this one will parsed as an argument to this option. Additionally, those options are added to @option{-F}. +An important feature of this options, is that you can but it in the end of the +command line, without any argument to get a random non-MLP:FiM pony. + @item --q [PONY...] @itemx --quotes [PONY...] @opindex @option{--q} diff --git a/ponysay.py b/ponysay.py index de6997a..51f8c72 100755 --- a/ponysay.py +++ b/ponysay.py @@ -319,13 +319,13 @@ class Ponysay(): ponies[pony] = ponydir + ponyfile ## Support for explicit pony file names - if not names == None: + if names is not None: for name in names: if os.path.exists(name): ponies[name] = name ## If there is not select ponies, choose all of them - if names == None: + if (names is None) or (len(names) == 0): names = list(ponies.keys()) ## Select a random pony of the choosen onles -- cgit From 994b19712a5f9fb1cb870ebd4f583e05a08f1c32 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 26 Oct 2012 16:20:57 +0200 Subject: distribution list update: source mage, parabola, arch linux arm; alphabetical order; nothing should distributions that are developer maintained and user maintained --- manuals/ponysay.texinfo | 56 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 703719e..1fa708f 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -1340,9 +1340,12 @@ before building and installing. @menu * Arch Linux:: Packages for Arch Linux. +* Arch Linux ARM:: Packages for Arch Linux ARM. * Chakra:: Packages for Chakra. -* Gentoo Linux:: Packages for Gentoo Linux. * Debian GNU/Linux:: Packages for Debian GNU/Linux and Ubuntu. +* Gentoo Linux:: Packages for Gentoo Linux. +* Parabola GNU/Linux:: Packages for Parabola GNU/Linux. +* Source Mage GNU/Linux:: Packages for Source Mage GNU/Linux. @end menu @@ -1351,16 +1354,37 @@ before building and installing. @cindex arch linux The official Arch Linux package repositories contains @command{ponysay} as -@w{@code{community/ponysay}}. The Arch Linux User Repository (AUR) contains a -bleeding edge git version of @command{ponysay} as @code{ponysay-git}. +@w{@code{community/ponysay}} (developer maintained). The Arch Linux User Repository +(AUR) contains a bleeding edge git version of @command{ponysay} as +@w{@code{ponysay-git}} (user maintained). + + +@node Arch Linux ARM +@subsection Arch Linux ARM +@cindex arch linux arm + +@w{@code{community/ponysay}} from Arch Linux (@ref{Arch Linux}) is also available +for Arch Linux ARM. @node Chakra @subsection Chakra @cindex chakra -Chakra users can install from (CCR) a stable version named a @code{ponysay}, -additionally a git verion of ponysay is available as @code{ponysay-git}. +Chakra users can install from (CCR) a stable version named a @code{ponysay} +(developer maintained Arch Linux mirror), additionally a git verion of ponysay is +available as @code{ponysay-git} (developer maintained Arch Linux mirror). + + +@node Debian GNU/Linux +@subsection Debian GNU/Linux and Ubuntu +@cindex debian gnu/linux +@cindex ubuntu + +A .deb file is available at @url{http://roryholland.co.uk/misc.html#ponysay} +(user maintained), and PPA:s can be found at +@url{https://launchpad.net/~vincent-c/+archive/ppa} (user maintained) and +@url{https://launchpad.net/~blazemore/+archive/ponysay} (user maintained). @node Gentoo Linux @@ -1368,17 +1392,23 @@ additionally a git verion of ponysay is available as @code{ponysay-git}. @cindex gentoo linux Gentoo users can use the overlay @url{https://github.com/etu/aidstu-overlay}, which -contains @command{ponysay} as @w{@code{games-misc/ponysay}}. +contains @command{ponysay} as @w{@code{games-misc/ponysay}} (developer maintained). -@node Debian GNU/Linux -@subsection Debian GNU/Linux and Ubuntu -@cindex debian gnu/linux -@cindex ubuntu +@node Parabola GNU/Linux +@subsection Parabola GNU/Linux +@cindex parabola gnu/linux + +@w{@code{community/ponysay}} from Arch Linux (@ref{Arch Linux}) is also available +for Parabola GNU/Linux. + + +@node Source Mage GNU/Linux +@subsection Source Mage GNU/Linux +@cindex source mage gnu/linux -A .deb file is available at @url{http://roryholland.co.uk/misc.html#ponysay}, -and PPA:s can be found at @url{https://launchpad.net/~vincent-c/+archive/ppa} and -@url{https://launchpad.net/~blazemore/+archive/ponysay}. +The spell @w{@code{util/ponysay}} (user maintained) is available in Grimoire for +Source Mage @w{GNU/Linux}. @node Uninstalling -- cgit From 4d27b0a8733980577811ff79ca217a11c5c15ac6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 27 Oct 2012 22:50:17 +0200 Subject: wrapping options from issue #108 --- CHANGELOG | 2 ++ completion/bash-completion.sh | 2 +- completion/fish-completion.fish | 6 ++---- completion/zsh-completion.zsh | 3 ++- manuals/manpage.0 | 4 +++- manuals/ponysay.texinfo | 11 ++++++++++- ponysay.py | 16 ++++++++++++---- 7 files changed, 32 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 94c0239..412d12f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,8 @@ Version 2.9 If file descriptor 3 is definied when ponysay is executed, extra information is printed to it. + Arguments starting with n or i is allowed for -W. + Version 2.8 diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index e9c284c..ae6a744 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -27,7 +27,7 @@ _ponysay() elif [ $prev = "-W" ] || [ $prev = "--wrap" ]; then cols=$(( `stty size | cut -d ' ' -f 2` - 10 )) - COMPREPLY=( $cols $(( $cols / 2 )) 100 60 ) + COMPREPLY=( $cols $(( $cols / 2 )) 100 60 none inherit ) fi } diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish index 044dd78..24e9b05 100644 --- a/completion/fish-completion.fish +++ b/completion/fish-completion.fish @@ -1,6 +1,4 @@ -# FISH completions for ponysay -# https://github.com/erkin/ponysay/ -# +# fish completion for ponysay -*- shell-script -*- # Author: Elis Axelsson set -g ponies ('/usr/bin/ponysay' --onelist) @@ -19,7 +17,7 @@ complete --command ponysay --short-option f --long-option pony --argument complete --command ponysay --short-option F --arguments "$xponies" --description 'extra pony' complete --command ponysay --short-option q --long-option quote --arguments "$quoters" --no-files --description 'pony' complete --command ponysay --short-option b --long-option balloon --arguments "$balloons" --no-files --description 'balloon style' -complete --command ponysay --short-option W --long-option wrap --arguments 'Integer' --description 'specify the column when the message should be wrapped' +complete --command ponysay --short-option W --long-option wrap --arguments 'Integer' --description 'specify the column when the message should be wrapped' ## TODO arguments `none` and `inherit` should be suggested complete --command ponysay --arguments 'MESSAGE' diff --git a/completion/zsh-completion.zsh b/completion/zsh-completion.zsh index 68487bd..ec00594 100644 --- a/completion/zsh-completion.zsh +++ b/completion/zsh-completion.zsh @@ -1,3 +1,4 @@ +# zsh completion for ponysay -*- shell-script -*- #compdef ponysay ponythink _opts=( '(--version -v)'{-v,--version}'[Show version and exit]' @@ -9,7 +10,7 @@ _opts=( '(-B --balloonlist)'{-B,--balloonlist}'[list balloon style names]' '(-b --ballon)'{-b,--balloon}'[Selecy a balloon style]: :_path_files -W '/usr/share/ponysay/balloons' -g "*(\:r)"' '(-c --compact)'{-c,--compat}'[Compress messages.]' - '(-W --wrap)'{-W,--wrap}'[The screen column where the message should be wrapped]' + '(-W --wrap)'{-W,--wrap}'[The screen column where the message should be wrapped]' # TODO arguments `none` and `inherit` should be suggested ) _tty_select=( '(-q --quite)'{-q,--quote}'[Select ponies for MLP:FiM quotes]: :_path_files -W '/usr/share/ponysay/ttyponies' -g "*(\:r)"' diff --git a/manuals/manpage.0 b/manuals/manpage.0 index 5407e2c..62fc9eb 100644 --- a/manuals/manpage.0 +++ b/manuals/manpage.0 @@ -80,7 +80,9 @@ is added as an argument to \fI-q\fP. If one or more ponies are added as an argum to \fI-q\fP the pony will be selected randomly from that set of ponies. .TP .B \-W, \-\-wrap \fIcolumn\fP -The screen column where the message should be wrapped. +The screen column where the message should be wrapped, the balloons extra width is taken +into consideration. If the argument is not an integer, but starts instead with \fIn\fP, +no wrapping is done, and if it starts with \fIi\fP the width of the terminal is used. .TP .B \-A, \-\-all List all pony files, MLP-FiM and non-MLP-FiM, in this case the first list are MLP:FiM diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 1fa708f..a558575 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -248,7 +248,14 @@ balloon style is specified a fallback style will be used. @opindex @option{-W} @opindex @option{--wrap} Specify the screen column where the message should be wrapped, this is by default 40, -as with @command{cowsay}. +as with @command{cowsay}. If the argument is not an integer, but starts instead with +@code{n} (for ‘none’ or ‘no’), no wrapping is done, and if it starts with @code{i} +(for ‘inherit’) the width of the terminal is used. + +@code{n} and @code{i} is case insensitive, so you may use @code{N} and @code{I} +instead. Additionally, typo correction is for QWERTY and Dvorak is built in to +@command{ponysay}; the nearest key, either to the left or to the right, depending +on which hand is used to press the key, is also allowed. @item -c @itemx --compress @@ -2054,6 +2061,8 @@ than unlimited. Currently this cannot be modified (without editing the source co @item If file descriptor 3 is definied when @command{ponysay} is executed, extra information is printed to it. +@item +Arguments starting with @code{n} or @code{i} is allowed for @option{-W}. @end itemize diff --git a/ponysay.py b/ponysay.py index 51f8c72..64b835c 100755 --- a/ponysay.py +++ b/ponysay.py @@ -806,11 +806,19 @@ class Ponysay(): if linuxvt: print('\033[H\033[2J', end='') - ## Width Get truncation and wrapping + ## Get width truncation and wrapping env_width = os.environ['PONYSAY_FULL_WIDTH'] if 'PONYSAY_FULL_WIDTH' in os.environ else None if env_width is None: env_width = '' widthtruncation = self.__gettermsize()[1] if env_width not in ('yes', 'y', '1') else None - messagewrap = int(args.opts['-W'][0]) if args.opts['-W'] is not None else None + messagewrap = 40 + if (args.opts['-W'] is not None) and (len(args.opts['-W'][0]) > 0): + messagewrap = args.opts['-W'][0] + if messagewrap[0] in 'nmsNMS': # m is left to n on QWERTY and s is left to n on Dvorak + messagewrap = None + elif messagewrap[0] in 'iouIOU': # o is left to i on QWERTY and u is right to i on Dvorak + messagewrap = self.__gettermsize()[1] + else: + messagewrap = int(args.opts['-W'][0]) ## Get balloon object balloonfile = self.__getballoonpath(args.opts['-b']) @@ -833,8 +841,8 @@ class Ponysay(): ## Run cowsay replacement - backend = Backend(message = msg, ponyfile = pony, wrapcolumn = messagewrap if messagewrap is not None else 40, - width = widthtruncation, balloon = balloon, hyphen = hyphen, linkcolour = linkcolour, ballooncolour = ballooncolour) + backend = Backend(message = msg, ponyfile = pony, wrapcolumn = messagewrap, width = widthtruncation, + balloon = balloon, hyphen = hyphen, linkcolour = linkcolour, ballooncolour = ballooncolour) backend.parse() output = backend.output if output.endswith('\n'): -- cgit From 99cfeea2d4f858a32f23ddf9031ed9593231428e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 27 Oct 2012 23:24:41 +0200 Subject: man: typo + info: update -W, balloon width consideration --- manuals/manpage.0 | 2 +- manuals/ponysay.texinfo | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/manuals/manpage.0 b/manuals/manpage.0 index 62fc9eb..4985964 100644 --- a/manuals/manpage.0 +++ b/manuals/manpage.0 @@ -80,7 +80,7 @@ is added as an argument to \fI-q\fP. If one or more ponies are added as an argum to \fI-q\fP the pony will be selected randomly from that set of ponies. .TP .B \-W, \-\-wrap \fIcolumn\fP -The screen column where the message should be wrapped, the balloons extra width is taken +The screen column where the message should be wrapped, the balloon's extra width is taken into consideration. If the argument is not an integer, but starts instead with \fIn\fP, no wrapping is done, and if it starts with \fIi\fP the width of the terminal is used. .TP diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index a558575..20ae9f6 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -248,9 +248,11 @@ balloon style is specified a fallback style will be used. @opindex @option{-W} @opindex @option{--wrap} Specify the screen column where the message should be wrapped, this is by default 40, -as with @command{cowsay}. If the argument is not an integer, but starts instead with -@code{n} (for ‘none’ or ‘no’), no wrapping is done, and if it starts with @code{i} -(for ‘inherit’) the width of the terminal is used. +as with @command{cowsay}. The balloon's extra width is taken into consideration. + +If the argument is not an integer, but starts instead with @code{n} (for ‘none’ or +‘no’), no wrapping is done, and if it starts with @code{i} (for ‘inherit’) the width +of the terminal is used. @code{n} and @code{i} is case insensitive, so you may use @code{N} and @code{I} instead. Additionally, typo correction is for QWERTY and Dvorak is built in to -- cgit From 7c50985a1313880564f98b705e3b4f7324b0d82e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 27 Oct 2012 23:43:38 +0200 Subject: spanish update on -W and prefer 'number' over 'integer' --- manuals/manpage.0 | 2 +- manuals/manpage.es.0 | 4 +++- manuals/ponysay.texinfo | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/manuals/manpage.0 b/manuals/manpage.0 index 4985964..fefc6ae 100644 --- a/manuals/manpage.0 +++ b/manuals/manpage.0 @@ -81,7 +81,7 @@ to \fI-q\fP the pony will be selected randomly from that set of ponies. .TP .B \-W, \-\-wrap \fIcolumn\fP The screen column where the message should be wrapped, the balloon's extra width is taken -into consideration. If the argument is not an integer, but starts instead with \fIn\fP, +into consideration. If the argument is not a number, but starts instead with \fIn\fP, no wrapping is done, and if it starts with \fIi\fP the width of the terminal is used. .TP .B \-A, \-\-all diff --git a/manuals/manpage.es.0 b/manuals/manpage.es.0 index 4dda148..80f79cb 100644 --- a/manuals/manpage.es.0 +++ b/manuals/manpage.es.0 @@ -82,7 +82,9 @@ uno o varios ponis sean agregados tras la opción \fI-q\fP, en cuyo caso se sele aleatoriamente uno de este conjunto. .TP .B \-W, \-\-wrap \fIcolumna\fP -El numero de columnas en el que será impreso el mensaje. +La columna donde el mensage será truncado, el globo puede tomar en consideración un largo mayor +si el argumento no es un numero, pero si inicia con \fIn\fP , no hay contenido y si es \fIi\fP +el largo de la terminal es usado es su lugar. .TP .B \-A. \-\-all Lista todos los ponis, tanto pertenecientes a MLP:FiM cono no pertenecientes a esta diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 20ae9f6..22429f1 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -250,7 +250,7 @@ balloon style is specified a fallback style will be used. Specify the screen column where the message should be wrapped, this is by default 40, as with @command{cowsay}. The balloon's extra width is taken into consideration. -If the argument is not an integer, but starts instead with @code{n} (for ‘none’ or +If the argument is not a number, but starts instead with @code{n} (for ‘none’ or ‘no’), no wrapping is done, and if it starts with @code{i} (for ‘inherit’) the width of the terminal is used. -- cgit