diff --git a/over/app.py b/over/app.py index 10b55d4..dbd72b1 100644 --- a/over/app.py +++ b/over/app.py @@ -79,6 +79,13 @@ class IncompleteArguments(Exception): return "option --%s takes a %d-word argument but has received %s" %(option_name, option_count, received or "none") +class BoolUsageError(Exception): + @property + def description(self): + option_name = self.args[0] + + return "option --%s is not boolean so you can't use --no-%s" %(option_name, option_name) + class NotAList(Exception): """ Option defaults must be in a list. @@ -459,6 +466,9 @@ class Main: except KeyError: raise UnknownOption(token) + if not option_is_positive and not option.is_boolean: + raise BoolUsageError(option.name) + last_read_option = option # single booleans are handled specially because of their --option/--no-option forms