mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 04:27:58 +01:00
setup.py: Added function to print fatal errors.
This commit is contained in:
parent
8cc55723de
commit
25682cdfe9
1 changed files with 6 additions and 3 deletions
9
setup.py
9
setup.py
|
@ -1148,13 +1148,13 @@ class ArgParser():
|
|||
optqueue.append(arg_opt)
|
||||
argqueue.append(arg[arg.index('=') + 1:])
|
||||
else:
|
||||
sys.stderr.write('%s: fatal: unrecognised option %s. see --help or the manual\n' % (self.__program, arg))
|
||||
self.print_fatal('Unrecognized option {}. Use the help command or consult the manual.', arg)
|
||||
exit(-1)
|
||||
elif (arg in self.optmap) and (self.optmap[arg][1] == ARGUMENTED):
|
||||
optqueue.append(arg)
|
||||
get = True
|
||||
else:
|
||||
sys.stderr.write('%s: fatal: unrecognised option %s. see --help or the manual\n' % (self.__program, arg))
|
||||
self.print_fatal('Unrecognized option {}. Use the help command or consult the manual.', arg)
|
||||
exit(-1)
|
||||
else:
|
||||
self.files.append(arg)
|
||||
|
@ -1168,9 +1168,12 @@ class ArgParser():
|
|||
if (opt not in self.opts) or (self.opts[opt] is None):
|
||||
self.opts[opt] = [arg]
|
||||
else:
|
||||
sys.stderr.write('%s: fatal: duplicate option %s\n' % (self.__program, arg))
|
||||
self.print_fatal('duplicate option {}', arg)
|
||||
exit(-1)
|
||||
|
||||
def print_fatal(self, message, *args):
|
||||
sys.stderr.write('{}: fatal: {}\n'.format(self.__program, message.format(*args)))
|
||||
|
||||
def usage(self):
|
||||
'''
|
||||
Print a short usage message.
|
||||
|
|
Loading…
Reference in a new issue