[DEV] add better error in arg parsing

This commit is contained in:
Edouard DUPIN 2013-05-24 22:02:09 +02:00
parent a181c5bdde
commit e1759a133e
2 changed files with 14 additions and 8 deletions

View File

@ -125,11 +125,15 @@ def Start():
debug.debug("change mode ==> " + mode) debug.debug("change mode ==> " + mode)
#remove previous target #remove previous target
target = None target = None
else:
if argument.GetOptionName() != "":
debug.warning("Can not understand argument : '" + argument.GetOptionName() + "'")
usage()
else: else:
#load the target if needed : #load the target if needed :
if target == None: if target == None:
target = lutinTarget.TargetLoad(targetName, compilator, mode, generatePackage) target = lutinTarget.TargetLoad(targetName, compilator, mode, generatePackage)
target.Build(argument.GetOptionName()) target.Build(argument.GetArg())
actionDone=True actionDone=True
# if no action done : we do "all" ... # if no action done : we do "all" ...
if actionDone==False: if actionDone==False:

View File

@ -15,9 +15,11 @@ class argElement:
def Display(self): def Display(self):
if len(self.m_arg)==0: if len(self.m_arg)==0:
debug.info("element : " + self.m_option) debug.info("option : " + self.m_option)
elif len(self.m_option)==0:
debug.info("element : " + self.m_arg)
else: else:
debug.info("element : " + self.m_option + ":" + self.m_arg) debug.info("option : " + self.m_option + ":" + self.m_arg)
class argDefine: class argDefine:
@ -229,7 +231,7 @@ class lutinArg:
if argumentFound==False: if argumentFound==False:
#unknow element ... ==> just add in the list ... #unknow element ... ==> just add in the list ...
debug.verbose("unknow argument : " + argument) debug.verbose("unknow argument : " + argument)
listArgument.append(argElement(argument, "")) listArgument.append(argElement("", argument))
#for argument in listArgument: #for argument in listArgument:
# argument.Display() # argument.Display()