From cbbb9be76c7ab4d7bec9c7f7afea3dda8fd949b6 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 15:50:42 +0200 Subject: Non-TV ponies --- configure | 35 +++++++++++++++++++++++++---------- extraponies/.info | 3 +++ extrattyponies/.info | 3 +++ ponysay | 51 +++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 extraponies/.info create mode 100644 extrattyponies/.info diff --git a/configure b/configure index 6f8b57d..5c63dd3 100755 --- a/configure +++ b/configure @@ -6,7 +6,7 @@ INFODESC=\''My Little Ponies for your terminal'\' SHELL='bash' completions='completion/bash-completion.sh completion/fish-completion.fish completion/zsh-completion.zsh' -shareDirs='ponies ttyponies quotes balloons' +shareDirs='ponies ttyponies quotes balloons extraponies extrattyponies' manFiles='manuals/manpage.6 manuals/manpage.es.6' licenseFiles='COPYING' @@ -360,15 +360,30 @@ EOF ttyponies: mkdir -p "ttyponies" - for pony in \$\$(ls --color=no "ponies/"); do \\ - echo "building ttypony: \$\$pony" ;\\ - if [ "\`readlink "ponies/\$\$pony"\`" = '' ]; then \\ - ponysay2ttyponysay < "ponies/\$\$pony" | tty2colourfultty -c 1 > "ttyponies/\$\$pony" ;\\ - git add "ttyponies/\$\$pony" ;\\ - else \\ - ln -sf \`readlink "ponies/\$\$pony"\` "ttyponies/\$\$pony" ;\\ - git add "ttyponies/\$\$pony" ;\\ - fi ;\\ + for pony in \$\$(ls --color=no "ponies/"); do \\ + if [ 1 "\$\$pony" = '.info' ]; then \\ + echo "building ttypony: \$\$pony" ;\\ + if [ "\`readlink "ponies/\$\$pony"\`" = '' ]; then \\ + ponysay2ttyponysay < "ponies/\$\$pony" | tty2colourfultty -c 1 > "ttyponies/\$\$pony" ;\\ + git add "ttyponies/\$\$pony" ;\\ + else \\ + ln -sf \`readlink "ponies/\$\$pony"\` "ttyponies/\$\$pony" ;\\ + git add "ttyponies/\$\$pony" ;\\ + fi ;\\ + fi ;\\ + done + mkdir -p "extrattyponies" + for pony in \$\$(ls --color=no "extraponies/"); do \\ + if [ 1 "\$\$pony" = '.info' ]; then \\ + echo "building extrattypony: \$\$pony" ;\\ + if [ "\`readlink "extraponies/\$\$pony"\`" = '' ]; then \\ + ponysay2ttyponysay < "extraponies/\$\$pony" | tty2colourfultty -c 1 > "extrattyponies/\$\$pony" ;\\ + git add "extrattyponies/\$\$pony" ;\\ + else \\ + ln -sf \`readlink "extraponies/\$\$pony"\` "extrattyponies/\$\$pony" ;\\ + git add "extrattyponies/\$\$pony" ;\\ + fi ;\\ + fi ;\\ done pdfmanual: diff --git a/extraponies/.info b/extraponies/.info new file mode 100644 index 0000000..12d5bea --- /dev/null +++ b/extraponies/.info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ponies should be placed here. diff --git a/extrattyponies/.info b/extrattyponies/.info new file mode 100644 index 0000000..333e827 --- /dev/null +++ b/extrattyponies/.info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ttyponies should be placed here. diff --git a/ponysay b/ponysay index 9fc8c70..62f6834 100755 --- a/ponysay +++ b/ponysay @@ -58,14 +58,24 @@ class Ponysay(): else: self.__bestpony(args) self.__ucsremap(args) + self.__extraponies(args) if args.opts['-q'] is not None: self.quote(args) else: self.print_pony(args) ## - ## Auxiliary methods + ## Methods that run in the beginning of non-listing and non-help stuff ## + ''' + Use best.pony if nothing else is set + ''' + def __bestpony(self, args): + if args.opts['-F'] is not None: + args.opts['-f'] = args.opts['-F'] + ponydirs = extraponydirs + + ''' Use best.pony if nothing else is set ''' @@ -118,6 +128,10 @@ class Ponysay(): args.opts[flag][i] = map[args.opts[flag][i]] + ## + ## Auxiliary methods + ## + ''' Apply USC:ise pony names according to UCS settings ''' @@ -1596,6 +1610,12 @@ Whether stderr is piped pipelineerr = not sys.stderr.isatty() +''' +Whether KMS is used +''' +usekms = Ponysay.isUsingKMS() + + ''' Root share/ directories ''' @@ -1607,17 +1627,27 @@ for sharedir in _sharedirs: ''' -The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY) +The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY) and not with KMS ''' ponydirs = [] -_kms = Ponysay.isUsingKMS() -if linuxvt and not _kms: _ponydirs = [d + 'ttyponies/' for d in sharedirs] -else: _ponydirs = [d + 'ponies/' for d in sharedirs] +if linuxvt and not usekms: _ponydirs = [d + 'ttyponies/' for d in sharedirs] +else: _ponydirs = [d + 'ponies/' for d in sharedirs] for ponydir in _ponydirs: if os.path.isdir(ponydir): ponydirs.append(ponydir) +''' +The directories where pony files are stored, extrattyponies/ are used if the terminal is Linux VT (also known as TTY) and not with KMS +''' +extraponydirs = [] +if linuxvt and not usekms: _extraponydirs = [d + 'extrattyponies/' for d in sharedirs] +else: _extraponydirs = [d + 'extraponies/' for d in sharedirs] +for extraponydir in _extraponydirs: + if os.path.isdir(extraponydir): + extraponydirs.append(extraponydir) + + ''' The directories where quotes files are stored ''' @@ -1638,11 +1668,11 @@ for balloondir in _balloondirs: balloondirs.append(balloondir) -usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' -usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' -usage_listhelp = '(-l | -L | -B | -v | -h)' -usage_file = '[-f \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' -usage_quote = '-q [\033[4mPONY\033[24m...]' +usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' +usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' +usage_listhelp = '(-l | -L | -B | -v | -h)' +usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' +usage_quote = '-q [\033[4mPONY\033[24m...]' usage = '%s %s\n%s %s %s\n%s %s %s' % (usage_saythink, usage_listhelp, usage_saythink, usage_common, usage_file, @@ -1677,6 +1707,7 @@ opts.add_argumentless(['-c', '--compact'], help = opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') opts.add_argumented( ['-b', '--bubble', '--balloon'], arg = 'STYLE', help = 'Select a balloon style.') opts.add_argumented( ['-f', '--file', '--pony'], arg = 'PONY', help = 'Select a pony.\nEither a file name or a pony name.') +opts.add_argumented( ['-F', '++file', '++pony'], arg = 'PONY', help = 'Select a non-MLP:FiM pony.') opts.add_variadic( ['-q', '--quote'], arg = 'PONY', help = 'Select a ponies which will quote themself.') opts.parse() -- cgit From 243612379e077eb46159cb64df51de2489b5c67f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 15:56:48 +0200 Subject: Non-TV ponies fix --- ponysay | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ponysay b/ponysay index 62f6834..f4480c0 100755 --- a/ponysay +++ b/ponysay @@ -56,24 +56,24 @@ class Ponysay(): elif args.opts['-L'] is not None: self.linklist() elif args.opts['-B'] is not None: self.balloonlist() else: + self.__extraponies(args) self.__bestpony(args) self.__ucsremap(args) - self.__extraponies(args) if args.opts['-q'] is not None: self.quote(args) else: self.print_pony(args) ## - ## Methods that run in the beginning of non-listing and non-help stuff + ## Methods that run before the mane methods ## ''' - Use best.pony if nothing else is set + Use extra ponies ''' - def __bestpony(self, args): + def __extraponies(self, args): if args.opts['-F'] is not None: args.opts['-f'] = args.opts['-F'] - ponydirs = extraponydirs + ponydirs[:] = extraponydirs ''' @@ -1668,11 +1668,11 @@ for balloondir in _balloondirs: balloondirs.append(balloondir) -usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' -usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' -usage_listhelp = '(-l | -L | -B | -v | -h)' -usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' -usage_quote = '-q [\033[4mPONY\033[24m...]' +usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' +usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' +usage_listhelp = '(-l | -L | -B | -v | -h)' +usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' +usage_quote = '-q [\033[4mPONY\033[24m...]' usage = '%s %s\n%s %s %s\n%s %s %s' % (usage_saythink, usage_listhelp, usage_saythink, usage_common, usage_file, -- cgit From a84f1d6534515e3264b6e87d9f13568de98feade Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:01:37 +0200 Subject: listing extra ponies --- ponysay | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ponysay b/ponysay index f4480c0..baea15c 100755 --- a/ponysay +++ b/ponysay @@ -55,6 +55,9 @@ class Ponysay(): elif args.opts['-l'] is not None: self.list() elif args.opts['-L'] is not None: self.linklist() elif args.opts['-B'] is not None: self.balloonlist() + elif args.opts['++onelist'] is not None: self.__extraponies(); self.onelist() + elif args.opts['+l'] is not None: self.__extraponies(); self.list() + elif args.opts['+L'] is not None: self.__extraponies(); self.linklist() else: self.__extraponies(args) self.__bestpony(args) @@ -70,8 +73,10 @@ class Ponysay(): ''' Use extra ponies ''' - def __extraponies(self, args): - if args.opts['-F'] is not None: + def __extraponies(self, args = None): + if args is None: + ponydirs[:] = extraponydirs + elif args.opts['-F'] is not None: args.opts['-f'] = args.opts['-F'] ponydirs[:] = extraponydirs @@ -1697,11 +1702,14 @@ run `man ponysay`. Ponysay has so much more to offer than described here.''') opts.add_argumentless(['--quoters']) opts.add_argumentless(['--onelist']) +opts.add_argumentless(['++onelist']) opts.add_argumentless(['-h', '--help'], help = 'Print this help message.') opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.') opts.add_argumentless(['-l', '--list'], help = 'List pony names.') opts.add_argumentless(['-L', '--altlist'], help = 'List pony names with alternatives.') +opts.add_argumentless(['+l', '++list'], help = 'List non-MLP:FiM pony names.') +opts.add_argumentless(['+L', '++altlist'], help = 'List non-MLP:FiM pony names with alternatives.') opts.add_argumentless(['-B', '--balloonlist'], help = 'List balloon styles.') opts.add_argumentless(['-c', '--compact'], help = 'Compress messages.') opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.') -- cgit From f830ba4cf7b21b50406fbccf32535ebda11c2ed9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:25:35 +0200 Subject: misc --- CHANGELOG | 3 ++ completion/bash-completion.sh | 8 +++-- completion/fish-completion.fish | 5 ++++ completion/zsh-completion.zsh | 5 +++- manuals/ponysay.texinfo | 66 +++++++++++++++++++++++++++++++++++++---- ponysay | 2 +- 6 files changed, 79 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e5136e5..d893033 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,9 @@ Version 2.3 Pony symlink added: pinkieoink → oinkoinkoink + Support for non-MLP:FiM ponies (known as extraponies), + although the directory is currently empty. + Version 2.2 diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index 72cafcb..62e1d40 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -5,13 +5,17 @@ _ponysay() local cur prev words cword _init_completion -n = || return - options='--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon' + options='--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon --file ++file ++pony ++list ++altlist' COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) - if [ $prev = "-f" ] || [ $prev = "--pony" ]; then + if [ $prev = "-f" ] || [ $prev = "--pony" ] || [ $prev = "--file" ]; then ponies=$('/usr/bin/ponysay' --onelist) COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) ) + elif [ $prev = "-F" ] || [ $prev = "++pony" ] || [ $prev = "++file" ]; then + extraponies=$('/usr/bin/ponysay' ++onelist) + COMPREPLY=( $( compgen -W "$extraponies" -- "$cur" ) ) + elif [ $prev = "-q" ] || [ $prev = "--quote" ]; then quoters=$('/usr/bin/ponysay' --quoters) COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) ) diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish index c211982..c29fff2 100644 --- a/completion/fish-completion.fish +++ b/completion/fish-completion.fish @@ -4,21 +4,26 @@ # Author: Elis Axelsson set -g ponies ('/usr/bin/ponysay' --onelist) +set -g xponies ('/usr/bin/ponysay' ++onelist) set -g quoters ('/usr/bin/ponysay' --quoters) set -g balloons ('/usr/bin/ponysay' --balloonlist) +## TODO: update with options [see info manual]: +l +L ++list ++altlist ++file --file ++pony complete --command ponysay --short-option h --long-option help --description 'help of ponysay' complete --command ponysay --short-option v --long-option version --description 'version of ponysay' complete --command ponysay --short-option l --long-option list --description 'list pony names' complete --command ponysay --short-option L --long-option altlist --description 'list pony names with alternatives' complete --command ponysay --short-option B --long-option balloonlist --description 'list balloon style names' complete --command ponysay --short-option f --long-option pony --arguments "$ponies" --description 'pony' +complete --command ponysay --short-option F --arguments "$xponies" --description 'extra pony' complete --command ponysay --short-option q --long-option quote --arguments "$quoters" --description 'pony' complete --command ponysay --short-option b --long-option balloon --arguments "$balloons" --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 --arguments 'MESSAGE' + set -e ponies +set -e xponies set -e quoters set -e balloons diff --git a/completion/zsh-completion.zsh b/completion/zsh-completion.zsh index c19604d..9d417ec 100644 --- a/completion/zsh-completion.zsh +++ b/completion/zsh-completion.zsh @@ -4,8 +4,11 @@ _shortopts=( '-h[Show this help and exit]' '-l[list pony names]' '-L[list pony names with alternatives]' + '+l[list extra pony names]' + '+L[list extra pony names with alternatives]' '-B[list balloon style names]' - '-f[Select a pony (either a file name or a pony name]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"' + '-f[Select a pony (either a file name or a pony name)]: :_path_files -W '/usr/share/ponysay/ponies' -g "*(\:r)"' + '-F[Select a extra pony]: :_path_files -W '/usr/share/ponysay/extraponies' -g "*(\:r)"' '-q[Select ponies for MLP:FiM quotes]' '-b[Selecy a balloon style]' '-W[The screen column where the message should be wrapped]' diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo index 6689d5f..312a542 100644 --- a/manuals/ponysay.texinfo +++ b/manuals/ponysay.texinfo @@ -150,6 +150,15 @@ In versions earlier than version 2.0, the if the pony were a file name it had to include a `@code{/}'. This is not longer required and any existing pony name supersedes file names. +@item -F +@itemx ++file PONY +@itemx ++pony PONY +@cindex @command{-F} +@cindex @command{++file} +@cindex @command{++pony} +Just as @command{-F}, but it uses extra (non-MLP:FiM) ponies instead of +standard (MLP:FiM) ponies + @item -b STYLE @itemx --bubble STYLE @itemx --balloon STYLE @@ -198,7 +207,7 @@ is installed the ponies which have quotes, i.e. can be used with the (depending on the terminal.) @item -L -@itemx --linklist +@itemx --altlist @cindex @command{-L} @cindex @command{--altlist} Lists all installed ponies. If the extension @command{ponyquotes4ponysay} @@ -208,6 +217,20 @@ is installed the ponies which have quotes, i.e. can be used with the printing alternative names (symbolic links) inside brackets after their target ponies. +@item +l +@itemx ++list +@cindex @command{+l} +@cindex @command{++list} +Just as @command{-l}, but it lists extra (non-MLP:FiM) ponies instead of +standard (MLP:FiM) ponies + +@item +L +@itemx ++altlist +@cindex @command{+L} +@cindex @command{++altlist} +Just as @command{-L}, but it lists extra (non-MLP:FiM) ponies instead of +standard (MLP:FiM) ponies + @item -B @itemx --balloonlist @cindex @command{-B} @@ -1058,14 +1081,19 @@ and only use Python 3, which as been accomplished in version 2.1. @cindex auto-completion, inner workings @cindex shell, auto-completion @cindex @command{--onelist} +@cindex @command{++onelist} @cindex @command{--quoters} To make it easier to write auto-completion for shells, @command{ponysay} supports -the two options @command{--onelist} and @command{--quoters}, which has not short -versions. +the two options @command{--onelist}, @command{++onelist} and @command{--quoters}, +which has nt short versions. -Executing @command{ponysay --onelist} will list every available pony, -independent of where it is located, the output is a sorted and consists only +Executing @command{ponysay --onelist} will list every available standard (MLP:FiM) +pony, independent of where it is located, the output is a sorted and consists only +of one pony per line. + +Executing @command{ponysay ++onelist} will list every available extra (non-MLP:FiM) +pony, independent of where it is located, the output is a sorted and consists only of one pony per line. @command{ponysay --quoters} work just as @command{ponysay --onelist}, excepts @@ -1172,13 +1200,20 @@ and as always regular files.) @item Support cowsay style message compression. @item -or @command{ponythink} Pony symlink added: @itemize @bullet @item @code{pinkieoink} → @code{oinkoinkoink} @end itemize +@item +Support for non-MLP:FiM ponies (known as extraponies), although the directory +is currently empty. +@c BEGIN the following is too descriptive for the plain/text change log +This is implemented with the options @code{-F}, @code{+l}, and @code{+L} +corresponding to @code{-f}, @code{-l}, and @code{-L}. +@c END @end itemize + @heading Version 2.2 @itemize @bullet @@ -1194,10 +1229,12 @@ Support custom balloon styles using the option @code{-b}, @code{-B} will list all available. This list depends on whether you are invoking @command{ponysay} @end itemize + @heading Version 2.1.1 Nothing worth mention. + @heading Version 2.1 @itemize @bullet @@ -1221,6 +1258,7 @@ minimum size of balloon. @c END @end itemize + @heading Version 2.0 @itemize @bullet @@ -1232,12 +1270,14 @@ All Perl scripts and almost all Bash are reimplemented in one Python 3 script. kmsponies4ponysay is included. @end itemize + @heading Version 1.4.1 @itemize @bullet @item Code is repaired and more portable. @end itemize + @heading Version 1.4 @itemize @bullet @@ -1247,6 +1287,7 @@ Make file is improved. @b{Note}: Identifies itself as version 1.3 + @heading Version 1.3 @itemize @bullet @@ -1263,6 +1304,7 @@ Pony symlink added: the default value is @code{/usr} @end itemize + @heading Version 1.2 @itemize @bullet @@ -1290,6 +1332,7 @@ file names including spaces.) @b{Note}: Identifies itself as version 1.1 + @heading Version 1.1 @itemize @bullet @@ -1338,6 +1381,7 @@ Support for extension: ponyquotes4ponysay. Accepts arbitrary spaces in @command{-f} argument. @end itemize + @heading Version 1.0 @itemize @bullet @@ -1368,6 +1412,7 @@ Improved TTY support: ponies have low colours resolution, instead of monochrome, when the high colour resolution is not available. @end itemize + @heading Version 0.10 @itemize @bullet @@ -1399,6 +1444,7 @@ Environment variables added: @code{PONYSAY_FULL_WIDTH}, @code{PONYSAY_SHELL_LINE @code{PONYSAY_TRUNCATE_HEIGHT}, @code{PONYSAY_BOTTOM}. @end itemize + @heading Version 0.9 @itemize @bullet @@ -1418,6 +1464,7 @@ Support for TTY (Linux VT). @code{sparkler}, @code{violet}. @end itemize + @heading Version 0.8 @itemize @bullet @@ -1447,6 +1494,7 @@ Support for TTY (Linux VT). @b{Note}: Identifies itself as version 0.7 + @heading Version 0.7 @itemize @bullet @@ -1457,6 +1505,7 @@ Support for TTY (Linux VT). Support for listing ponies with @command{-l} option. @end itemize + @heading Version 0.6 @itemize @bullet @@ -1469,6 +1518,7 @@ Dropping usage of utility @command{which}, using @command{hash} instead. @b{Note}: Identifies itself as version 0.5 + @heading Version 0.5 @itemize @bullet @@ -1476,6 +1526,7 @@ Dropping usage of utility @command{which}, using @command{hash} instead. Using utility @command{which} to determine existence of @command{cowsay}. @end itemize + @heading Version 0.4 @itemize @bullet @@ -1491,6 +1542,7 @@ Select random pony if not specified. @command{-f} supports file names, and not only pony names. @end itemize + @heading Version 0.3 @itemize @bullet @@ -1498,6 +1550,7 @@ Select random pony if not specified. Fixed use of @code{.pony} files. @end itemize + @heading Version 0.2 @itemize @bullet @@ -1512,6 +1565,7 @@ Pony files end with @code{.pony} instead of @code{.cow}. @command{-h} prints proper help. @end itemize + @heading Version 0.1 First release. diff --git a/ponysay b/ponysay index baea15c..67a7d2e 100755 --- a/ponysay +++ b/ponysay @@ -1675,7 +1675,7 @@ for balloondir in _balloondirs: usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m' usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]' -usage_listhelp = '(-l | -L | -B | -v | -h)' +usage_listhelp = '(-l | -L | -B | +l | +L | -v | -h)' usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)' usage_quote = '-q [\033[4mPONY\033[24m...]' -- cgit From 19f2a5a8a49c590164d1ba02af33347add9b68fb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:29:37 +0200 Subject: make fix for extra ponies --- configure | 2 +- extraponies/.info | 3 --- extraponies/info | 3 +++ extrattyponies/.info | 3 --- extrattyponies/info | 3 +++ 5 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 extraponies/.info create mode 100644 extraponies/info delete mode 100644 extrattyponies/.info create mode 100644 extrattyponies/info diff --git a/configure b/configure index 5c63dd3..de1ab00 100755 --- a/configure +++ b/configure @@ -224,7 +224,7 @@ function makeMakefile() echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/"' for dir in $shareDirs; do echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/'"$dir"'"' - echo -en '\t' ; echo 'cp -P "'"$dir"'/"*.* "$(INSTALLDIR)/share/ponysay/'"$dir"'/"' + echo -en '\t' ; echo 'cp -P "'"$dir"'/"* "$(INSTALLDIR)/share/ponysay/'"$dir"'/"' done echo echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/bin/"' diff --git a/extraponies/.info b/extraponies/.info deleted file mode 100644 index 12d5bea..0000000 --- a/extraponies/.info +++ /dev/null @@ -1,3 +0,0 @@ -Dummy file for this directory as it is otherwise empty. - -Non-MLP:FiM ponies should be placed here. diff --git a/extraponies/info b/extraponies/info new file mode 100644 index 0000000..12d5bea --- /dev/null +++ b/extraponies/info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ponies should be placed here. diff --git a/extrattyponies/.info b/extrattyponies/.info deleted file mode 100644 index 333e827..0000000 --- a/extrattyponies/.info +++ /dev/null @@ -1,3 +0,0 @@ -Dummy file for this directory as it is otherwise empty. - -Non-MLP:FiM ttyponies should be placed here. diff --git a/extrattyponies/info b/extrattyponies/info new file mode 100644 index 0000000..333e827 --- /dev/null +++ b/extrattyponies/info @@ -0,0 +1,3 @@ +Dummy file for this directory as it is otherwise empty. + +Non-MLP:FiM ttyponies should be placed here. -- cgit From d3ddf64433b38558a4dc83eba36469a971dd9640 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 22 Aug 2012 16:36:47 +0200 Subject: final touches on extra ponies --- ponysay | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ponysay b/ponysay index 67a7d2e..faca1d3 100755 --- a/ponysay +++ b/ponysay @@ -282,8 +282,6 @@ class Ponysay(): quoters = self.__quoters() for ponydir in ponydirs: # Loop ponydirs - print('\033[1mponies located in ' + ponydir + '\033[21m') - _ponies = os.listdir(ponydir) ponies = [] for pony in _ponies: @@ -292,6 +290,10 @@ class Ponysay(): self.__ucsise(ponies) ponies.sort() + if len(ponies) == 0: + continue + print('\033[1mponies located in ' + ponydir + '\033[21m') + width = UCS.dispLen(max(ponies, key = UCS.dispLen)) + 2 # Get the longest ponyfilename lenght + 2 spaces x = 0 @@ -314,13 +316,16 @@ class Ponysay(): quoters = self.__quoters() for ponydir in ponydirs: # Loop ponydirs - print('\033[1mponies located in ' + ponydir + '\033[21m') - _ponies = os.listdir(ponydir) ponies = [] for pony in _ponies: if (len(pony) > 5) and (pony[-5:] == '.pony'): ponies.append(pony[:-5]) + + if len(ponies) == 0: + continue + print('\033[1mponies located in ' + ponydir + '\033[21m') + pseudolinkmap = {} self.__ucsise(ponies, pseudolinkmap) ##TODO pairs = [] -- cgit