per-command options

Finally commands can define their own options.

Moved --format and --print0 to be options only of find.
This commit is contained in:
Joey Hess 2012-01-05 22:48:59 -04:00
parent 47be4383b7
commit ad43f03626
9 changed files with 162 additions and 87 deletions

View file

@ -8,6 +8,7 @@
module Types.Command where
import Types
import Types.Option
{- A command runs in these stages.
-
@ -32,14 +33,15 @@ type CommandPerform = Annex (Maybe CommandCleanup)
type CommandCleanup = Annex Bool
{- A command is defined by specifying these things. -}
data Command = Command {
cmdnorepo :: Maybe (IO ()), -- an action to run when not in a repo
cmdcheck :: [CommandCheck], -- check stage
cmdname :: String,
cmdparamdesc :: String, -- description of params for usage
cmdseek :: [CommandSeek], -- seek stage
cmddesc :: String -- description of command for usage
}
data Command = Command
{ cmdoptions :: [Option] -- command-specific options
, cmdnorepo :: Maybe (IO ()) -- an action to run when not in a repo
, cmdcheck :: [CommandCheck] -- check stage
, cmdname :: String
, cmdparamdesc :: String -- description of params for usage
, cmdseek :: [CommandSeek] -- seek stage
, cmddesc :: String -- description of command for usage
}
{- CommandCheck functions can be compared using their unique id. -}
instance Eq CommandCheck where