# HG changeset patch # User Alexander Solovyov <piranha@piranha.org.ua> # Date 1249652837 -10800 # Node ID 78fa11005c8384623e90fa0ed7bd06c816075f99 # Parent 74b690e796068c6e3be622f020caea985988f214 Check if short name is of length == 1 diff -r 74b690e79606 -r 78fa11005c83 finaloption.py --- a/finaloption.py Tue Aug 04 20:30:02 2009 +0300 +++ b/finaloption.py Fri Aug 07 16:47:17 2009 +0300 @@ -264,6 +264,9 @@ shortlist, namelist = '', [] for short, name, default, comment in options: + if short and len(short) != 1: + raise FOError('Short option should be only a single' + ' character: %s' % short) # change name to match Python styling pyname = name.replace('-', '_') argmap['-' + short] = argmap['--' + name] = pyname @@ -427,6 +430,8 @@ except getopt.GetoptError, e: err('error: %s\n' % e) help_func() + except FOError, e: + err('%s\n' % e) except KeyboardInterrupt: err('interrupted!\n') except SystemExit: @@ -488,3 +493,6 @@ class Abort(CommandException): 'Abort execution' + +class FOError(CommandException): + 'Raised on trouble with finaloption configuration'