summaryrefslogtreecommitdiff
path: root/Command.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-15 02:02:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-15 02:02:46 -0400
commit56bc3e95cabb85e5f23e30b453f90438c33efbb8 (patch)
treec13ac69cfc2b5ba9582aa5c1ebd427bc0d337b16 /Command.hs
parentb400984ddf9aeb24c3d67e87cfeb29470618636c (diff)
refactor some boilerplate
Diffstat (limited to 'Command.hs')
-rw-r--r--Command.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Command.hs b/Command.hs
index 9c908b800..d9e94a2f3 100644
--- a/Command.hs
+++ b/Command.hs
@@ -65,12 +65,22 @@ data Command = Command {
cmdusesrepo :: Bool
}
+{- Most commands operate on files in a git repo. -}
repoCommand :: String -> String -> [CommandSeek] -> String -> Command
repoCommand n p s d = Command n p s d True
+{- Others can run anywhere. -}
standaloneCommand :: String -> String -> [CommandSeek] -> String -> Command
standaloneCommand n p s d = Command n p s d False
+{- For start and perform stages to indicate what step to run next. -}
+next :: a -> Annex (Maybe a)
+next a = return $ Just a
+
+{- Or to indicate nothing needs to be done. -}
+stop :: Annex (Maybe a)
+stop = return Nothing
+
{- Prepares a list of actions to run to perform a command, based on
- the parameters passed to it. -}
prepCommand :: Command -> [String] -> Annex [Annex Bool]