mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-25 13:57:59 +01:00
Non-TV ponies
This commit is contained in:
parent
d378b2bc58
commit
cbbb9be76c
4 changed files with 72 additions and 20 deletions
17
configure
vendored
17
configure
vendored
|
@ -6,7 +6,7 @@ INFODESC=\''My Little Ponies for your terminal'\'
|
||||||
SHELL='bash'
|
SHELL='bash'
|
||||||
|
|
||||||
completions='completion/bash-completion.sh completion/fish-completion.fish completion/zsh-completion.zsh'
|
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'
|
manFiles='manuals/manpage.6 manuals/manpage.es.6'
|
||||||
licenseFiles='COPYING'
|
licenseFiles='COPYING'
|
||||||
|
|
||||||
|
@ -361,6 +361,7 @@ EOF
|
||||||
ttyponies:
|
ttyponies:
|
||||||
mkdir -p "ttyponies"
|
mkdir -p "ttyponies"
|
||||||
for pony in \$\$(ls --color=no "ponies/"); do \\
|
for pony in \$\$(ls --color=no "ponies/"); do \\
|
||||||
|
if [ 1 "\$\$pony" = '.info' ]; then \\
|
||||||
echo "building ttypony: \$\$pony" ;\\
|
echo "building ttypony: \$\$pony" ;\\
|
||||||
if [ "\`readlink "ponies/\$\$pony"\`" = '' ]; then \\
|
if [ "\`readlink "ponies/\$\$pony"\`" = '' ]; then \\
|
||||||
ponysay2ttyponysay < "ponies/\$\$pony" | tty2colourfultty -c 1 > "ttyponies/\$\$pony" ;\\
|
ponysay2ttyponysay < "ponies/\$\$pony" | tty2colourfultty -c 1 > "ttyponies/\$\$pony" ;\\
|
||||||
|
@ -369,6 +370,20 @@ ttyponies:
|
||||||
ln -sf \`readlink "ponies/\$\$pony"\` "ttyponies/\$\$pony" ;\\
|
ln -sf \`readlink "ponies/\$\$pony"\` "ttyponies/\$\$pony" ;\\
|
||||||
git add "ttyponies/\$\$pony" ;\\
|
git add "ttyponies/\$\$pony" ;\\
|
||||||
fi ;\\
|
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
|
done
|
||||||
|
|
||||||
pdfmanual:
|
pdfmanual:
|
||||||
|
|
3
extraponies/.info
Normal file
3
extraponies/.info
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Dummy file for this directory as it is otherwise empty.
|
||||||
|
|
||||||
|
Non-MLP:FiM ponies should be placed here.
|
3
extrattyponies/.info
Normal file
3
extrattyponies/.info
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Dummy file for this directory as it is otherwise empty.
|
||||||
|
|
||||||
|
Non-MLP:FiM ttyponies should be placed here.
|
41
ponysay
41
ponysay
|
@ -58,14 +58,24 @@ class Ponysay():
|
||||||
else:
|
else:
|
||||||
self.__bestpony(args)
|
self.__bestpony(args)
|
||||||
self.__ucsremap(args)
|
self.__ucsremap(args)
|
||||||
|
self.__extraponies(args)
|
||||||
if args.opts['-q'] is not None: self.quote(args)
|
if args.opts['-q'] is not None: self.quote(args)
|
||||||
else: self.print_pony(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
|
Use best.pony if nothing else is set
|
||||||
'''
|
'''
|
||||||
|
@ -118,6 +128,10 @@ class Ponysay():
|
||||||
args.opts[flag][i] = map[args.opts[flag][i]]
|
args.opts[flag][i] = map[args.opts[flag][i]]
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
## Auxiliary methods
|
||||||
|
##
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Apply USC:ise pony names according to UCS settings
|
Apply USC:ise pony names according to UCS settings
|
||||||
'''
|
'''
|
||||||
|
@ -1596,6 +1610,12 @@ Whether stderr is piped
|
||||||
pipelineerr = not sys.stderr.isatty()
|
pipelineerr = not sys.stderr.isatty()
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Whether KMS is used
|
||||||
|
'''
|
||||||
|
usekms = Ponysay.isUsingKMS()
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Root share/ directories
|
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 = []
|
ponydirs = []
|
||||||
_kms = Ponysay.isUsingKMS()
|
if linuxvt and not usekms: _ponydirs = [d + 'ttyponies/' for d in sharedirs]
|
||||||
if linuxvt and not _kms: _ponydirs = [d + 'ttyponies/' for d in sharedirs]
|
|
||||||
else: _ponydirs = [d + 'ponies/' for d in sharedirs]
|
else: _ponydirs = [d + 'ponies/' for d in sharedirs]
|
||||||
for ponydir in _ponydirs:
|
for ponydir in _ponydirs:
|
||||||
if os.path.isdir(ponydir):
|
if os.path.isdir(ponydir):
|
||||||
ponydirs.append(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
|
The directories where quotes files are stored
|
||||||
'''
|
'''
|
||||||
|
@ -1641,7 +1671,7 @@ for balloondir in _balloondirs:
|
||||||
usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m'
|
usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m'
|
||||||
usage_common = '[-c] [-W \033[4mCOLUMN\033[24m] [-b \033[4mSTYLE\033[24m]'
|
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 | -v | -h)'
|
||||||
usage_file = '[-f \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)'
|
usage_file = '[(-f | -F) \033[4mPONY\033[24m]... ([--] \033[4mmessage\033[24m | <<<\033[4mmessage\033[24m)'
|
||||||
usage_quote = '-q [\033[4mPONY\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 = '%s %s\n%s %s %s\n%s %s %s' % (usage_saythink, usage_listhelp,
|
||||||
|
@ -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( ['-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( ['-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 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.add_variadic( ['-q', '--quote'], arg = 'PONY', help = 'Select a ponies which will quote themself.')
|
||||||
|
|
||||||
opts.parse()
|
opts.parse()
|
||||||
|
|
Loading…
Reference in a new issue