mirror of
https://github.com/erkin/ponysay
synced 2024-11-16 08:27:58 +00:00
merge conflict resolve
This commit is contained in:
commit
e27f83da41
1 changed files with 8 additions and 17 deletions
25
ponysay.py
25
ponysay.py
|
@ -27,12 +27,6 @@ The directory where ponysay is installed, this is modified when building with ma
|
|||
INSTALLDIR = '/usr'
|
||||
|
||||
|
||||
'''
|
||||
The user's home directory
|
||||
'''
|
||||
HOME = os.environ['HOME']
|
||||
|
||||
|
||||
'''
|
||||
The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY)
|
||||
'''
|
||||
|
@ -86,14 +80,18 @@ class ponysay():
|
|||
def __getponypath(self, names = None):
|
||||
ponies = {}
|
||||
|
||||
for name in names:
|
||||
if os.path.isfile(name):
|
||||
return name
|
||||
if names != None:
|
||||
for name in names:
|
||||
if os.path.isfile(name):
|
||||
return name
|
||||
|
||||
for ponydir in ponydirs:
|
||||
for ponyfile in os.listdir(ponydir):
|
||||
ponies[ponyfile[:-5]] = ponydir + ponyfile
|
||||
|
||||
if names == None:
|
||||
names = list(ponies.keys())
|
||||
|
||||
return ponies[names[random.randrange(0, len(names))]]
|
||||
|
||||
|
||||
|
@ -278,15 +276,8 @@ class ponysay():
|
|||
|
||||
|
||||
def print_pony(self, args):
|
||||
ponycount = 0
|
||||
for ponydir in ponydirs:
|
||||
ponycount = len(os.listdir(ponydir))
|
||||
if ponycount == 0:
|
||||
sys.stderr.write('All the ponies are missing! Call the Princess!')
|
||||
exit(1);
|
||||
|
||||
if args.message == None:
|
||||
msg = sys.stdin.read()
|
||||
msg = sys.stdin.read().strip()
|
||||
else:
|
||||
msg = args.message
|
||||
|
||||
|
|
Loading…
Reference in a new issue