mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 04:27:58 +01:00
.ponysayrc support
This commit is contained in:
parent
388a6ed142
commit
e5379adb32
1 changed files with 11 additions and 1 deletions
12
ponysay.py
12
ponysay.py
|
@ -830,7 +830,7 @@ class Ponysay():
|
|||
balloon = self.__getballoon(balloonfile) if args.opts['-o'] is None else None
|
||||
|
||||
## Get hyphen style
|
||||
hyphen = environ['PONYSAY_BOTTOM'] if 'PONYSAY_BOTTOM' in os.environ else None
|
||||
hyphen = os.environ['PONYSAY_WRAP_HYPHEN'] if 'PONYSAY_WRAP_HYPHEN' in os.environ else None
|
||||
if (hyphen is None) or (len(hyphen) == 0):
|
||||
hyphen = '-'
|
||||
hyphencolour = ''
|
||||
|
@ -2281,6 +2281,16 @@ if __name__ == '__main__':
|
|||
'''
|
||||
HOME = os.environ['HOME'] if 'HOME' in os.environ else os.path.expanduser('~')
|
||||
|
||||
## Change system enviroments with ~/.ponysayrc
|
||||
if os.path.exists(HOME + '/.ponysayrc'):
|
||||
with open(HOME + '/.ponysayrc', 'rb') as ponysayrc:
|
||||
code = ponysayrc.read().decode('utf8', 'replace') + '\n'
|
||||
env = os.environ
|
||||
code = compile(code, HOME + '/.ponysayrc', 'exec')
|
||||
exec(code)
|
||||
|
||||
HOME = os.environ['HOME'] if 'HOME' in os.environ else os.path.expanduser('~') # in case ~/.ponysayrc changes it
|
||||
|
||||
|
||||
'''
|
||||
Whether the program is execute in Linux VT (TTY)
|
||||
|
|
Loading…
Reference in a new issue