mirror of
https://github.com/erkin/ponysay.git
synced 2025-02-12 07:46:44 +01:00
merge conflict resolve
This commit is contained in:
commit
e27f83da41
1 changed files with 8 additions and 17 deletions
19
ponysay.py
19
ponysay.py
|
@ -27,12 +27,6 @@ The directory where ponysay is installed, this is modified when building with ma
|
||||||
INSTALLDIR = '/usr'
|
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)
|
The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY)
|
||||||
'''
|
'''
|
||||||
|
@ -86,6 +80,7 @@ class ponysay():
|
||||||
def __getponypath(self, names = None):
|
def __getponypath(self, names = None):
|
||||||
ponies = {}
|
ponies = {}
|
||||||
|
|
||||||
|
if names != None:
|
||||||
for name in names:
|
for name in names:
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
return name
|
return name
|
||||||
|
@ -94,6 +89,9 @@ class ponysay():
|
||||||
for ponyfile in os.listdir(ponydir):
|
for ponyfile in os.listdir(ponydir):
|
||||||
ponies[ponyfile[:-5]] = ponydir + ponyfile
|
ponies[ponyfile[:-5]] = ponydir + ponyfile
|
||||||
|
|
||||||
|
if names == None:
|
||||||
|
names = list(ponies.keys())
|
||||||
|
|
||||||
return ponies[names[random.randrange(0, len(names))]]
|
return ponies[names[random.randrange(0, len(names))]]
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,15 +276,8 @@ class ponysay():
|
||||||
|
|
||||||
|
|
||||||
def print_pony(self, args):
|
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:
|
if args.message == None:
|
||||||
msg = sys.stdin.read()
|
msg = sys.stdin.read().strip()
|
||||||
else:
|
else:
|
||||||
msg = args.message
|
msg = args.message
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue