mirror of
https://github.com/erkin/ponysay.git
synced 2025-03-29 14:57:43 +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
|
balloon = self.__getballoon(balloonfile) if args.opts['-o'] is None else None
|
||||||
|
|
||||||
## Get hyphen style
|
## 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):
|
if (hyphen is None) or (len(hyphen) == 0):
|
||||||
hyphen = '-'
|
hyphen = '-'
|
||||||
hyphencolour = ''
|
hyphencolour = ''
|
||||||
|
@ -2281,6 +2281,16 @@ if __name__ == '__main__':
|
||||||
'''
|
'''
|
||||||
HOME = os.environ['HOME'] if 'HOME' in os.environ else os.path.expanduser('~')
|
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)
|
Whether the program is execute in Linux VT (TTY)
|
||||||
|
|
Loading…
Add table
Reference in a new issue