hooks: keywords can have optional values: place a question mark before =

{
	    "keyword?=X": "help about keyword (precise the default value if needed)"
	}
This commit is contained in:
nemunaire 2018-09-26 06:35:44 +02:00
parent 46541cb35e
commit 445a66ea90

View File

@ -43,7 +43,7 @@ class Dict(Abstract):
def check(self, mkw):
for k in mkw:
if (mkw[k] and k not in self.chk_args) or (not mkw[k] and k not in self.chk_noarg):
if ((k + "?") not in self.chk_args) and ((mkw[k] and k not in self.chk_args) or (not mkw[k] and k not in self.chk_noarg)):
if mkw[k] and k in self.chk_noarg:
raise KeywordException("Keyword %s doesn't take value." % k)
elif not mkw[k] and k in self.chk_args: