diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-08-18 17:57:50 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-08-18 17:57:50 +0200 |
commit | 1dc737fb8b51e224ed29e60ae3c1751e3d54f31f (patch) | |
tree | 27d0007c396ce09c1f07d7bc3ba95cb69c6d96ba /ponysay.py | |
parent | 6e754c5509228f7c9b7d2aa3eca0ab6fb4e211d6 (diff) | |
download | ponysay-1dc737fb8b51e224ed29e60ae3c1751e3d54f31f.tar.gz ponysay-1dc737fb8b51e224ed29e60ae3c1751e3d54f31f.tar.bz2 ponysay-1dc737fb8b51e224ed29e60ae3c1751e3d54f31f.zip |
m misc
Diffstat (limited to 'ponysay.py')
-rwxr-xr-x | ponysay.py | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -41,11 +41,17 @@ HOME = os.environ['HOME'] ''' +Whether the program is execute in Linux VT (TTY) +''' +linuxvt = os.environ['TERM'] == 'linux' + + +''' The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY) ''' ponydirs = [] -if os.environ['TERM'] == 'linux': _ponydirs = [HOME + '/.local/share/ponysay/ttyponies/', INSTALLDIR + '/share/ponysay/ttyponies/'] -else: _ponydirs = [HOME + '/.local/share/ponysay/ponies/', INSTALLDIR + '/share/ponysay/ponies/' ] +if linuxvt: _ponydirs = [HOME + '/.local/share/ponysay/ttyponies/', INSTALLDIR + '/share/ponysay/ttyponies/'] +else: _ponydirs = [HOME + '/.local/share/ponysay/ponies/', INSTALLDIR + '/share/ponysay/ponies/' ] for ponydir in _ponydirs: if os.path.isdir(ponydir): ponydirs.append(ponydir) @@ -320,9 +326,11 @@ class ponysay(): pony = self.__getponypath(args.pony) - if "think.py" in __file__: cmd = 'cowthink' + if 'think.py' in __file__: cmd = 'cowthink' else: cmd = 'cowsay' + if linuxvt: + print('\033[H\033[2J', end='') os.system(cmd + (' -W ' + args.wrap if args.wrap is not None else '') + ' -f ' + pony + ' \'' + msg + '\'') |