aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay51
1 files changed, 41 insertions, 10 deletions
diff --git a/ponysay b/ponysay
index 9fc8c70..62f6834 100755
--- a/ponysay
+++ b/ponysay
@@ -58,18 +58,28 @@ 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
+ '''
+ def __bestpony(self, args):
if (args.opts['-f'] is None) or (args.opts['-q'] is None) or (len(args.opts['-q']) == 0):
for ponydir in ponydirs:
if os.path.isfile(ponydir + 'best.pony') or os.path.islink(ponydir + 'best.pony'):
@@ -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
'''
@@ -1597,6 +1611,12 @@ pipelineerr = not sys.stderr.isatty()
'''
+Whether KMS is used
+'''
+usekms = Ponysay.isUsingKMS()
+
+
+'''
Root share/ directories
'''
sharedirs = []
@@ -1607,18 +1627,28 @@ 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
'''
quotedirs = []
@@ -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()