From b9aa944b09e60badb99c65a87f5689e0ab9010e3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 18 Sep 2011 18:21:42 -0400 Subject: add --and --or --not -( and -) I dislike -( and -), but without using a different option parser, can't easily use bare parens. --and and --or will become more useful once there are more interesting limits than --exclude --- Options.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Options.hs') diff --git a/Options.hs b/Options.hs index ee3ce6620..44d5f3674 100644 --- a/Options.hs +++ b/Options.hs @@ -14,6 +14,7 @@ import Control.Monad.State (liftIO) import qualified Annex import Types import Command +import Limit {- Each dashed command-line option results in generation of an action - in the Annex monad that performs the necessary setting. @@ -47,3 +48,15 @@ commonOptions = setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v } setdebug = liftIO $ updateGlobalLogger rootLoggerName $ setLevel DEBUG + +matcherOptions :: [Option] +matcherOptions = + [ longopt "not" "negate next option" + , longopt "and" "both previous and next option must match" + , longopt "or" "either previous or next option must match" + , shortopt "(" "open group of options" + , shortopt ")" "close group of options" + ] + where + longopt o d = Option [] [o] (NoArg (token o)) d + shortopt o d = Option o [] (NoArg (token o)) d -- cgit v1.2.3