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:
parent
47be4383b7
commit
ad43f03626
9 changed files with 162 additions and 87 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue