aboutsummaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-05 22:48:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-05 23:11:07 -0400
commitad43f0362688a601ba43f462e80f5a91bf398c02 (patch)
tree550788062a775eb6b2c2c087052993aa10435875 /Command.hs
parent47be4383b714320c9e3f49cc23315101fad5735b (diff)
per-command options
Finally commands can define their own options. Moved --format and --print0 to be options only of find.
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Command.hs b/Command.hs
index dea6a97a3..b287629ae 100644
--- a/Command.hs
+++ b/Command.hs
@@ -8,6 +8,7 @@
module Command (
command,
noRepo,
+ withOptions,
next,
stop,
stopUnless,
@@ -26,22 +27,28 @@ import qualified Backend
import qualified Annex
import qualified Git
import Types.Command as ReExported
+import Types.Option as ReExported
import Seek as ReExported
import Checks as ReExported
import Options as ReExported
+import Usage as ReExported
import Logs.Trust
import Logs.Location
import Config
{- Generates a normal command -}
command :: String -> String -> [CommandSeek] -> String -> Command
-command = Command Nothing commonChecks
+command = Command [] Nothing commonChecks
{- Adds a fallback action to a command, that will be run if it's used
- outside a git repository. -}
noRepo :: IO () -> Command -> Command
noRepo a c = c { cmdnorepo = Just a }
+{- Adds options to a command. -}
+withOptions :: [Option] -> Command -> Command
+withOptions o c = c { cmdoptions = o }
+
{- For start and perform stages to indicate what step to run next. -}
next :: a -> Annex (Maybe a)
next a = return $ Just a