mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-25 22:07:58 +01:00
Check if script is being launched in subshell or being redirected to file, and make -l to --onelist. This more or less depricates '--onelist' as flag
This commit is contained in:
parent
fec01d4646
commit
62a3d88d58
1 changed files with 11 additions and 1 deletions
10
ponysay.py
10
ponysay.py
|
@ -46,6 +46,12 @@ Whether the program is execute in Linux VT (TTY)
|
|||
linuxvt = os.environ['TERM'] == 'linux'
|
||||
|
||||
|
||||
'''
|
||||
Whether the program is launched in subshell/beeing redirected
|
||||
'''
|
||||
redirected = not sys.stdout.isatty()
|
||||
|
||||
|
||||
'''
|
||||
The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY)
|
||||
'''
|
||||
|
@ -99,6 +105,10 @@ class ponysay():
|
|||
Starts the part of the program the arguments indicate
|
||||
'''
|
||||
def __init__(self, args):
|
||||
if args.list and redirected:
|
||||
args.list = False
|
||||
args.onelist = True
|
||||
|
||||
if args.list: self.list()
|
||||
elif args.linklist: self.linklist()
|
||||
elif args.quoters: self.quoters()
|
||||
|
|
Loading…
Reference in a new issue