refactor some boilerplate
This commit is contained in:
parent
b400984ddf
commit
56bc3e95ca
31 changed files with 93 additions and 86 deletions
10
Command.hs
10
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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue