convert all commands to work with optparse-applicative
Still no options though.
This commit is contained in:
parent
3125da54f6
commit
6e5c1f8db3
99 changed files with 391 additions and 297 deletions
|
@ -20,7 +20,7 @@ type Batchable t = BatchMode -> t -> CommandStart
|
|||
-- In batch mode, one line at a time is read, parsed, and a reply output to
|
||||
-- stdout. In non batch mode, the command's parameters are parsed and
|
||||
-- a reply output for each.
|
||||
batchable :: ((t -> CommandStart) -> CommandSeek) -> Batchable t -> CommandSeek
|
||||
batchable :: ((t -> CommandStart) -> CmdParams -> CommandSeek) -> Batchable t -> CmdParams -> CommandSeek
|
||||
batchable seeker starter params = ifM (getOptionFlag batchOption)
|
||||
( batchloop
|
||||
, seeker (starter NoBatch) params
|
||||
|
|
|
@ -16,7 +16,6 @@ import Utility.Env
|
|||
import Annex.Ssh
|
||||
|
||||
import qualified Command.Add
|
||||
{-
|
||||
import qualified Command.Unannex
|
||||
import qualified Command.Drop
|
||||
import qualified Command.Move
|
||||
|
@ -117,12 +116,10 @@ import qualified Command.TestRemote
|
|||
#ifdef WITH_EKG
|
||||
import System.Remote.Monitoring
|
||||
#endif
|
||||
-}
|
||||
|
||||
cmds :: [Command]
|
||||
cmds =
|
||||
[ Command.Add.cmd
|
||||
{-
|
||||
, Command.Get.cmd
|
||||
, Command.Drop.cmd
|
||||
, Command.Move.cmd
|
||||
|
@ -221,7 +218,6 @@ cmds =
|
|||
, Command.FuzzTest.cmd
|
||||
, Command.TestRemote.cmd
|
||||
#endif
|
||||
-}
|
||||
]
|
||||
|
||||
header :: String
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{- git-annex usage messages
|
||||
-
|
||||
- Copyright 2010-2011 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2010-2015 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
@ -8,10 +8,10 @@
|
|||
module CmdLine.Usage where
|
||||
|
||||
import Common.Annex
|
||||
|
||||
import Types.Command
|
||||
|
||||
import System.Console.GetOpt
|
||||
import qualified Options.Applicative as O
|
||||
|
||||
usageMessage :: String -> String
|
||||
usageMessage s = "Usage: " ++ s
|
||||
|
@ -56,6 +56,13 @@ commandUsage cmd = unlines
|
|||
, "[option ...]"
|
||||
]
|
||||
|
||||
{- Simple CommandParser generator, for when the CommandSeek wants all
|
||||
- non-option parameters. -}
|
||||
withParams :: (CmdParams -> CommandSeek) -> String -> CommandParser
|
||||
withParams mkseek paramdesc = mkseek <$> O.many cmdparams
|
||||
where
|
||||
cmdparams = O.argument O.str (O.metavar paramdesc)
|
||||
|
||||
{- Descriptions of params used in usage messages. -}
|
||||
paramPaths :: String
|
||||
paramPaths = paramRepeating paramPath -- most often used
|
||||
|
|
18
Command.hs
18
Command.hs
|
@ -7,7 +7,6 @@
|
|||
|
||||
module Command (
|
||||
command,
|
||||
commandParser,
|
||||
noRepo,
|
||||
noCommit,
|
||||
noMessages,
|
||||
|
@ -33,20 +32,11 @@ import CmdLine.Action as ReExported
|
|||
import CmdLine.Option as ReExported
|
||||
import CmdLine.GitAnnex.Options as ReExported
|
||||
|
||||
import qualified Options.Applicative as O
|
||||
|
||||
{- Generates a normal Command -}
|
||||
command :: String -> String -> CommandSection -> String -> (Command -> CommandParser) -> Command
|
||||
command name paramdesc section desc parser = c
|
||||
where
|
||||
c = Command [] Nothing commonChecks False False name paramdesc section desc (parser c)
|
||||
|
||||
{- Simple CommandParser generator, for when the CommandSeek wants all
|
||||
- non-option parameters. -}
|
||||
commandParser :: (CmdParams -> CommandSeek) -> Command -> CommandParser
|
||||
commandParser mkseek c = mkseek <$> O.many cmdparams
|
||||
where
|
||||
cmdparams = O.argument O.str (O.metavar (cmdparamdesc c))
|
||||
command :: String -> CommandSection -> String -> String -> (String -> CommandParser) -> Command
|
||||
command name section desc paramdesc mkparser =
|
||||
Command [] Nothing commonChecks False False name paramdesc
|
||||
section desc (mkparser paramdesc)
|
||||
|
||||
{- Indicates that a command doesn't need to commit any changes to
|
||||
- the git-annex branch. -}
|
||||
|
|
|
@ -36,8 +36,8 @@ import Control.Exception (IOException)
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ withOptions addOptions $
|
||||
command "add" paramPaths SectionCommon "add files to annex"
|
||||
(commandParser seek)
|
||||
command "add" SectionCommon "add files to annex"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
addOptions :: [Option]
|
||||
addOptions = includeDotFilesOption : fileMatchingOptions
|
||||
|
@ -71,8 +71,8 @@ startSmall file = do
|
|||
|
||||
performAdd :: FilePath -> CommandPerform
|
||||
performAdd file = do
|
||||
params <- forceParams
|
||||
Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
|
||||
ps <- forceParams
|
||||
Annex.Queue.addCommand "add" (ps++[Param "--"]) [file]
|
||||
next $ return True
|
||||
|
||||
{- The add subcommand annexes a file, generating a key for it using a
|
||||
|
@ -279,8 +279,8 @@ addLink :: FilePath -> Key -> Maybe InodeCache -> Annex ()
|
|||
addLink file key mcache = ifM (coreSymlinks <$> Annex.getGitConfig)
|
||||
( do
|
||||
_ <- link file key mcache
|
||||
params <- forceParams
|
||||
Annex.Queue.addCommand "add" (params++[Param "--"]) [file]
|
||||
ps <- forceParams
|
||||
Annex.Queue.addCommand "add" (ps++[Param "--"]) [file]
|
||||
, do
|
||||
l <- link file key mcache
|
||||
addAnnexLink l file
|
||||
|
|
|
@ -15,10 +15,12 @@ import Command.Unused (withUnusedMaps, UnusedMaps(..), startUnused)
|
|||
import Types.Key
|
||||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ command "addunused" (paramRepeating paramNumRange)
|
||||
seek SectionMaintenance "add back unused files"
|
||||
cmd = notDirect $
|
||||
command "addunused" SectionMaintenance
|
||||
"add back unused files"
|
||||
(paramRepeating paramNumRange) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withUnusedMaps start
|
||||
|
||||
start :: UnusedMaps -> Int -> CommandStart
|
||||
|
|
|
@ -39,8 +39,8 @@ import qualified Utility.Quvi as Quvi
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ withOptions [fileOption, pathdepthOption, relaxedOption, rawOption] $
|
||||
command "addurl" (paramRepeating paramUrl) seek
|
||||
SectionCommon "add urls to annex"
|
||||
command "addurl" SectionCommon "add urls to annex"
|
||||
(paramRepeating paramUrl) (withParams seek)
|
||||
|
||||
fileOption :: Option
|
||||
fileOption = fieldOption [] "file" paramFile "specify what file the url is added to"
|
||||
|
@ -54,7 +54,7 @@ relaxedOption = flagOption [] "relaxed" "skip size check"
|
|||
rawOption :: Option
|
||||
rawOption = flagOption [] "raw" "disable special handling for torrents, quvi, etc"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek us = do
|
||||
optfile <- getOptionField fileOption return
|
||||
relaxed <- getOptionFlag relaxedOption
|
||||
|
|
|
@ -21,8 +21,9 @@ import System.Environment
|
|||
|
||||
cmd :: Command
|
||||
cmd = noRepo checkNoRepoOpts $ dontCheck repoExists $ withOptions options $
|
||||
notBareRepo $ command "assistant" paramNothing seek SectionCommon
|
||||
notBareRepo $ command "assistant" SectionCommon
|
||||
"automatically sync changes"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
options :: [Option]
|
||||
options =
|
||||
|
@ -42,7 +43,7 @@ autoStopOption = flagOption [] "autostop" "stop in known repositories"
|
|||
startDelayOption :: Option
|
||||
startDelayOption = fieldOption [] "startdelay" paramNumber "delay before running startup scan"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
stopdaemon <- getOptionFlag Command.Watch.stopOption
|
||||
foreground <- getOptionFlag Command.Watch.foregroundOption
|
||||
|
|
|
@ -15,10 +15,13 @@ import Annex
|
|||
import Types.Messages
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "checkpresentkey" (paramPair paramKey paramRemote) seek
|
||||
SectionPlumbing "check if key is present in remote"
|
||||
cmd = noCommit $
|
||||
command "checkpresentkey" SectionPlumbing
|
||||
"check if key is present in remote"
|
||||
(paramPair paramKey paramRemote)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -13,9 +13,9 @@ import qualified Annex.Branch
|
|||
import qualified Git
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "commit" paramNothing
|
||||
SectionPlumbing "commits any staged changes to the git-annex branch"
|
||||
(commandParser seek)
|
||||
cmd = command "commit" SectionPlumbing
|
||||
"commits any staged changes to the git-annex branch"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
|
|
@ -16,9 +16,10 @@ import qualified Git.Config
|
|||
import Remote.GCrypt (coreGCryptId)
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "configlist" paramNothing
|
||||
SectionPlumbing "outputs relevant git configuration"
|
||||
(commandParser seek)
|
||||
cmd = noCommit $
|
||||
command "configlist" SectionPlumbing
|
||||
"outputs relevant git configuration"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
|
|
@ -14,10 +14,11 @@ import Annex.Content
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions [batchOption] $ noCommit $ noMessages $
|
||||
command "contentlocation" (paramRepeating paramKey) seek
|
||||
SectionPlumbing "looks up content for a key"
|
||||
command "contentlocation" SectionPlumbing
|
||||
"looks up content for a key"
|
||||
(paramRepeating paramKey) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = batchable withKeys start
|
||||
|
||||
start :: Batchable Key
|
||||
|
|
|
@ -15,13 +15,15 @@ import Annex.Wanted
|
|||
import Annex.NumCopies
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions copyOptions $ command "copy" paramPaths seek
|
||||
SectionCommon "copy content of files to/from another repository"
|
||||
cmd = withOptions copyOptions $
|
||||
command "copy" SectionCommon
|
||||
"copy content of files to/from another repository"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
copyOptions :: [Option]
|
||||
copyOptions = Command.Move.moveOptions ++ [autoOption]
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
to <- getOptionField toOption Remote.byNameWithUUID
|
||||
from <- getOptionField fromOption Remote.byNameWithUUID
|
||||
|
|
|
@ -18,14 +18,14 @@ import Remote (keyLocations)
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions [keyOption] $
|
||||
command "dead" (paramRepeating paramRemote) seek
|
||||
SectionSetup "hide a lost repository or key"
|
||||
command "dead" SectionSetup "hide a lost repository or key"
|
||||
(paramRepeating paramRemote) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = maybe (trustCommand "dead" DeadTrusted ps) (flip seekKey ps)
|
||||
=<< Annex.getField "key"
|
||||
|
||||
seekKey :: String -> CommandSeek
|
||||
seekKey :: String -> CmdParams -> CommandSeek
|
||||
seekKey ks = case file2key ks of
|
||||
Nothing -> error "Invalid key"
|
||||
Just key -> withNothing (startKey key)
|
||||
|
|
|
@ -13,10 +13,12 @@ import qualified Remote
|
|||
import Logs.UUID
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "describe" (paramPair paramRemote paramDesc) seek
|
||||
SectionSetup "change description of a repository"
|
||||
cmd = command "describe" SectionSetup
|
||||
"change description of a repository"
|
||||
(paramPair paramRemote paramDesc)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -15,10 +15,11 @@ import Git.Types
|
|||
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $
|
||||
command "diffdriver" ("[-- cmd --]") seek
|
||||
SectionPlumbing "external git diff driver shim"
|
||||
command "diffdriver" SectionPlumbing
|
||||
"external git diff driver shim"
|
||||
("-- cmd --") (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -17,10 +17,10 @@ import Annex.Direct
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ noDaemonRunning $
|
||||
command "direct" paramNothing seek
|
||||
SectionSetup "switch repository to direct mode"
|
||||
command "direct" SectionSetup "switch repository to direct mode"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -23,8 +23,10 @@ import Annex.Notification
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions (dropOptions) $ command "drop" paramPaths seek
|
||||
SectionCommon "indicate content of files not currently wanted"
|
||||
cmd = withOptions (dropOptions) $
|
||||
command "drop" SectionCommon
|
||||
"indicate content of files not currently wanted"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
dropOptions :: [Option]
|
||||
dropOptions = dropFromOption : annexedMatchingOptions ++ [autoOption] ++ keyOptions
|
||||
|
@ -32,7 +34,7 @@ dropOptions = dropFromOption : annexedMatchingOptions ++ [autoOption] ++ keyOpti
|
|||
dropFromOption :: Option
|
||||
dropFromOption = fieldOption ['f'] "from" paramRemote "drop content from a remote"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
from <- getOptionField dropFromOption Remote.byNameWithUUID
|
||||
auto <- getOptionFlag autoOption
|
||||
|
|
|
@ -14,9 +14,11 @@ import Logs.Location
|
|||
import Annex.Content
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "dropkey" (paramRepeating paramKey)
|
||||
SectionPlumbing "drops annexed content for specified keys"
|
||||
(commandParser seek)
|
||||
cmd = noCommit $
|
||||
command "dropkey" SectionPlumbing
|
||||
"drops annexed content for specified keys"
|
||||
(paramRepeating paramKey)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withKeys start
|
||||
|
|
|
@ -18,10 +18,11 @@ import Annex.NumCopies
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions [Command.Drop.dropFromOption] $
|
||||
command "dropunused" (paramRepeating paramNumRange)
|
||||
seek SectionMaintenance "drop unused file content"
|
||||
command "dropunused" SectionMaintenance
|
||||
"drop unused file content"
|
||||
(paramRepeating paramNumRange) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
numcopies <- getNumCopies
|
||||
withUnusedMaps (start numcopies) ps
|
||||
|
|
|
@ -16,11 +16,12 @@ import qualified Command.InitRemote as InitRemote
|
|||
import qualified Data.Map as M
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "enableremote"
|
||||
cmd = command "enableremote" SectionSetup
|
||||
"enables use of an existing special remote"
|
||||
(paramPair paramName $ paramOptional $ paramRepeating paramKeyValue)
|
||||
seek SectionSetup "enables use of an existing special remote"
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -16,10 +16,11 @@ import Types.Key
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ noMessages $ withOptions [formatOption, jsonOption, batchOption] $
|
||||
command "examinekey" (paramRepeating paramKey) seek
|
||||
SectionPlumbing "prints information from a key"
|
||||
command "examinekey" SectionPlumbing
|
||||
"prints information from a key"
|
||||
(paramRepeating paramKey) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
format <- getFormat
|
||||
batchable withKeys (start format) ps
|
||||
|
|
|
@ -21,8 +21,10 @@ import Data.Time.Clock.POSIX
|
|||
import qualified Data.Map as M
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions [activityOption, noActOption] $ command "expire" paramExpire seek
|
||||
SectionMaintenance "expire inactive repositories"
|
||||
cmd = withOptions [activityOption, noActOption] $
|
||||
command "expire" SectionMaintenance
|
||||
"expire inactive repositories"
|
||||
paramExpire (withParams seek)
|
||||
|
||||
paramExpire :: String
|
||||
paramExpire = (paramRepeating $ paramOptional paramRemote ++ ":" ++ paramTime)
|
||||
|
@ -33,7 +35,7 @@ activityOption = fieldOption [] "activity" "Name" "specify activity"
|
|||
noActOption :: Option
|
||||
noActOption = flagOption [] "no-act" "don't really do anything"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
expire <- parseExpire ps
|
||||
wantact <- getOptionField activityOption (pure . parseActivity)
|
||||
|
|
|
@ -21,7 +21,8 @@ import Types.Key
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions annexedMatchingOptions $ mkCommand $
|
||||
command "find" paramPaths seek SectionQuery "lists available files"
|
||||
command "find" SectionQuery "lists available files"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
mkCommand :: Command -> Command
|
||||
mkCommand = noCommit . noMessages . withOptions [formatOption, print0Option, jsonOption]
|
||||
|
@ -38,7 +39,7 @@ print0Option = Option [] ["print0"] (NoArg set)
|
|||
where
|
||||
set = Annex.setField (optionName formatOption) "${file}\0"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
format <- getFormat
|
||||
withFilesInGit (whenAnnexed $ start format) ps
|
||||
|
|
|
@ -12,10 +12,11 @@ import qualified Command.Find as Find
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions nonWorkTreeMatchingOptions $ Find.mkCommand $
|
||||
command "findref" paramRef seek SectionPlumbing
|
||||
command "findref" SectionPlumbing
|
||||
"lists files in a git ref"
|
||||
paramRef (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek refs = do
|
||||
format <- Find.getFormat
|
||||
Find.start format `withFilesInRefs` refs
|
||||
|
|
|
@ -20,9 +20,9 @@ import Utility.Touch
|
|||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ noCommit $ withOptions annexedMatchingOptions $
|
||||
command "fix" paramPaths
|
||||
SectionMaintenance "fix up symlinks to point to annexed content"
|
||||
(commandParser seek)
|
||||
command "fix" SectionMaintenance
|
||||
"fix up symlinks to point to annexed content"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withFilesInGit $ whenAnnexed start
|
||||
|
|
|
@ -16,8 +16,10 @@ import qualified Annex
|
|||
import Data.Time.Clock.POSIX
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions forgetOptions $ command "forget" paramNothing seek
|
||||
SectionMaintenance "prune git-annex branch history"
|
||||
cmd = withOptions forgetOptions $
|
||||
command "forget" SectionMaintenance
|
||||
"prune git-annex branch history"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
forgetOptions :: [Option]
|
||||
forgetOptions = [dropDeadOption]
|
||||
|
@ -25,7 +27,7 @@ forgetOptions = [dropDeadOption]
|
|||
dropDeadOption :: Option
|
||||
dropDeadOption = flagOption [] "drop-dead" "drop references to dead repositories"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
dropdead <- getOptionFlag dropDeadOption
|
||||
withNothing (start dropdead) ps
|
||||
|
|
|
@ -21,10 +21,11 @@ import Network.URI
|
|||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ notBareRepo $
|
||||
command "fromkey" (paramPair paramKey paramPath) seek
|
||||
SectionPlumbing "adds a file using a specific key"
|
||||
command "fromkey" SectionPlumbing "adds a file using a specific key"
|
||||
(paramPair paramKey paramPath)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
force <- Annex.getState Annex.force
|
||||
withWords (start force) ps
|
||||
|
|
|
@ -41,8 +41,9 @@ import Data.Time.Clock.POSIX
|
|||
import System.Posix.Types (EpochTime)
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions fsckOptions $ command "fsck" paramPaths seek
|
||||
SectionMaintenance "check for problems"
|
||||
cmd = withOptions fsckOptions $
|
||||
command "fsck" SectionMaintenance "check for problems"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
fsckFromOption :: Option
|
||||
fsckFromOption = fieldOption ['f'] "from" paramRemote "check remote"
|
||||
|
@ -65,7 +66,7 @@ fsckOptions =
|
|||
, incrementalScheduleOption
|
||||
] ++ keyOptions ++ annexedMatchingOptions
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
from <- getOptionField fsckFromOption Remote.byNameWithUUID
|
||||
u <- maybe getUUID (pure . Remote.uuid) from
|
||||
|
|
|
@ -21,10 +21,12 @@ import Test.QuickCheck
|
|||
import Control.Concurrent
|
||||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ command "fuzztest" paramNothing seek SectionTesting
|
||||
"generates fuzz test files"
|
||||
cmd = notBareRepo $
|
||||
command "fuzztest" SectionTesting
|
||||
"generates fuzz test files"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -15,9 +15,9 @@ import qualified Git
|
|||
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $ noCommit $
|
||||
command "gcryptsetup" paramValue
|
||||
SectionPlumbing "sets up gcrypt repository"
|
||||
(commandParser seek)
|
||||
command "gcryptsetup" SectionPlumbing
|
||||
"sets up gcrypt repository"
|
||||
paramValue (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withStrings start
|
||||
|
|
|
@ -17,14 +17,16 @@ import Annex.Wanted
|
|||
import qualified Command.Move
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions getOptions $ command "get" paramPaths seek
|
||||
SectionCommon "make content of annexed files available"
|
||||
cmd = withOptions getOptions $
|
||||
command "get" SectionCommon
|
||||
"make content of annexed files available"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
getOptions :: [Option]
|
||||
getOptions = fromOption : autoOption : jobsOption : annexedMatchingOptions
|
||||
++ incompleteOption : keyOptions
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
from <- getOptionField fromOption Remote.byNameWithUUID
|
||||
auto <- getOptionFlag autoOption
|
||||
|
|
|
@ -16,10 +16,10 @@ import Types.Group
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "group" (paramPair paramRemote paramDesc) seek
|
||||
SectionSetup "add a repository to a group"
|
||||
cmd = command "group" SectionSetup "add a repository to a group"
|
||||
(paramPair paramRemote paramDesc) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -13,10 +13,12 @@ import Logs.PreferredContent
|
|||
import Command.Wanted (performGet, performSet)
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "groupwanted" (paramPair paramGroup (paramOptional paramExpression)) seek
|
||||
SectionSetup "get or set groupwanted expression"
|
||||
cmd = command "groupwanted" SectionSetup
|
||||
"get or set groupwanted expression"
|
||||
(paramPair paramGroup (paramOptional paramExpression))
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -23,9 +23,10 @@ import System.Console.GetOpt
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ noRepo startNoRepo $ dontCheck repoExists $
|
||||
command "help" "COMMAND" seek SectionCommon "display help"
|
||||
command "help" SectionCommon "display help"
|
||||
"COMMAND" (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
@ -47,7 +48,7 @@ showCommonOptions = putStrLn $ usageInfo "Common options:" gitAnnexOptions
|
|||
showGeneralHelp :: IO ()
|
||||
showGeneralHelp = putStrLn $ unlines
|
||||
[ "The most frequently used git-annex commands are:"
|
||||
, unlines $ map cmdline $ concat
|
||||
, unlines $ map cmdline $
|
||||
[ Command.Init.cmd
|
||||
, Command.Add.cmd
|
||||
, Command.Drop.cmd
|
||||
|
|
|
@ -23,8 +23,10 @@ import Types.TrustLevel
|
|||
import Logs.Trust
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions opts $ notBareRepo $ command "import" paramPaths seek
|
||||
SectionCommon "move and add files from outside git working copy"
|
||||
cmd = withOptions opts $ notBareRepo $
|
||||
command "import" SectionCommon
|
||||
"move and add files from outside git working copy"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
opts :: [Option]
|
||||
opts = duplicateModeOptions ++ fileMatchingOptions
|
||||
|
@ -60,7 +62,7 @@ getDuplicateMode = go . catMaybes <$> mapM getflag [minBound..maxBound]
|
|||
go ms = error $ "cannot combine " ++
|
||||
unwords (map (optionParam . fromJust . associatedOption) ms)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
mode <- getDuplicateMode
|
||||
repopath <- liftIO . absPath =<< fromRepo Git.repoPath
|
||||
|
|
|
@ -45,13 +45,13 @@ import Annex.MetaData
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ withOptions [templateOption, relaxedOption, rawOption] $
|
||||
command "importfeed" (paramRepeating paramUrl) seek
|
||||
SectionCommon "import files from podcast feeds"
|
||||
command "importfeed" SectionCommon "import files from podcast feeds"
|
||||
(paramRepeating paramUrl) (withParams seek)
|
||||
|
||||
templateOption :: Option
|
||||
templateOption = fieldOption [] "template" paramFormat "template for filenames"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
tmpl <- getOptionField templateOption return
|
||||
relaxed <- getOptionFlag relaxedOption
|
||||
|
|
|
@ -12,9 +12,11 @@ import Command
|
|||
import Annex.Content
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "inannex" (paramRepeating paramKey)
|
||||
SectionPlumbing "checks if keys are present in the annex"
|
||||
(commandParser seek)
|
||||
cmd = noCommit $
|
||||
command "inannex" SectionPlumbing
|
||||
"checks if keys are present in the annex"
|
||||
(paramRepeating paramKey)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withKeys start
|
||||
|
|
|
@ -24,10 +24,10 @@ import qualified Command.Add
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ noDaemonRunning $
|
||||
command "indirect" paramNothing seek
|
||||
SectionSetup "switch repository to indirect mode"
|
||||
command "indirect" SectionSetup "switch repository to indirect mode"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -80,10 +80,11 @@ type StatState = StateT StatInfo Annex
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ dontCheck repoExists $ withOptions (jsonOption : bytesOption : annexedMatchingOptions) $
|
||||
command "info" (paramRepeating paramItem) seek SectionQuery
|
||||
"shows information about the specified item or the repository as a whole"
|
||||
command "info" SectionQuery
|
||||
"shows information about the specified item or the repository as a whole"
|
||||
(paramRepeating paramItem) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -13,9 +13,10 @@ import Annex.Init
|
|||
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $
|
||||
command "init" paramDesc seek SectionSetup "initialize git-annex"
|
||||
command "init" SectionSetup "initialize git-annex"
|
||||
paramDesc (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -20,11 +20,12 @@ import Logs.Trust
|
|||
import Data.Ord
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "initremote"
|
||||
cmd = command "initremote" SectionSetup
|
||||
"creates a special (non-git) remote"
|
||||
(paramPair paramName $ paramOptional $ paramRepeating paramKeyValue)
|
||||
seek SectionSetup "creates a special (non-git) remote"
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -25,13 +25,14 @@ import Git.Types (RemoteName)
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ withOptions (allrepos : annexedMatchingOptions) $
|
||||
command "list" paramPaths seek
|
||||
SectionQuery "show which remotes contain files"
|
||||
command "list" SectionQuery
|
||||
"show which remotes contain files"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
allrepos :: Option
|
||||
allrepos = flagOption [] "allrepos" "show all repositories, not only remotes"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
list <- getList
|
||||
printHeader list
|
||||
|
|
|
@ -14,10 +14,11 @@ import qualified Annex
|
|||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ withOptions annexedMatchingOptions $
|
||||
command "lock" paramPaths seek SectionCommon
|
||||
"undo unlock command"
|
||||
command "lock" SectionCommon
|
||||
"undo unlock command"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
withFilesUnlocked start ps
|
||||
withFilesUnlockedToBeCommitted start ps
|
||||
|
|
|
@ -40,7 +40,8 @@ type Outputter = Bool -> POSIXTime -> [UUID] -> Annex ()
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions options $
|
||||
command "log" paramPaths seek SectionQuery "shows location log"
|
||||
command "log" SectionQuery "shows location log"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
options :: [Option]
|
||||
options = passthruOptions ++ [gourceOption] ++ annexedMatchingOptions
|
||||
|
@ -56,7 +57,7 @@ passthruOptions = map odate ["since", "after", "until", "before"] ++
|
|||
gourceOption :: Option
|
||||
gourceOption = flagOption [] "gource" "format output for gource"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
m <- Remote.uuidDescriptions
|
||||
zone <- liftIO getCurrentTimeZone
|
||||
|
|
|
@ -15,10 +15,11 @@ import Types.Key
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions [batchOption] $ notBareRepo $ noCommit $ noMessages $
|
||||
command "lookupkey" (paramRepeating paramFile) seek
|
||||
SectionPlumbing "looks up key used for file"
|
||||
command "lookupkey" SectionPlumbing
|
||||
"looks up key used for file"
|
||||
(paramRepeating paramFile) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = batchable withStrings start
|
||||
|
||||
start :: Batchable String
|
||||
|
|
|
@ -27,10 +27,11 @@ data Link = Link Git.Repo Git.Repo
|
|||
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $
|
||||
command "map" paramNothing seek SectionQuery
|
||||
command "map" SectionQuery
|
||||
"generate map of repositories"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -14,10 +14,11 @@ import qualified Git.Branch
|
|||
import Command.Sync (prepMerge, mergeLocal)
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "merge" paramNothing seek SectionMaintenance
|
||||
cmd = command "merge" SectionMaintenance
|
||||
"automatically merge changes from remotes"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
withNothing mergeBranch ps
|
||||
withNothing mergeSynced ps
|
||||
|
|
|
@ -18,8 +18,9 @@ import Data.Time.Clock.POSIX
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions metaDataOptions $
|
||||
command "metadata" paramPaths seek
|
||||
SectionMetaData "sets or gets metadata of a file"
|
||||
command "metadata"
|
||||
SectionMetaData "sets or gets metadata of a file"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
metaDataOptions :: [Option]
|
||||
metaDataOptions =
|
||||
|
@ -52,7 +53,7 @@ untagOption = Option ['u'] ["untag"] (ReqArg mkmod "TAG") "remove a tag"
|
|||
where
|
||||
mkmod = storeModMeta . AddMeta tagMetaField . mkMetaValue (CurrentlySet False)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
modmeta <- Annex.getState Annex.modmeta
|
||||
getfield <- getOptionField getOption $ \ms ->
|
||||
|
|
|
@ -20,10 +20,11 @@ import qualified Annex
|
|||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ withOptions annexedMatchingOptions $
|
||||
command "migrate" paramPaths seek
|
||||
SectionUtility "switch data to different backend"
|
||||
command "migrate" SectionUtility
|
||||
"switch data to different backend"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withFilesInGit $ whenAnnexed start
|
||||
|
||||
start :: FilePath -> Key -> CommandStart
|
||||
|
|
|
@ -17,13 +17,15 @@ import Annex.Content
|
|||
import Annex.NumCopies
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions mirrorOptions $ command "mirror" paramPaths seek
|
||||
SectionCommon "mirror content of files to/from another repository"
|
||||
cmd = withOptions mirrorOptions $
|
||||
command "mirror" SectionCommon
|
||||
"mirror content of files to/from another repository"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
mirrorOptions :: [Option]
|
||||
mirrorOptions = fromToOptions ++ [jobsOption] ++ annexedMatchingOptions ++ keyOptions
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
to <- getOptionField toOption Remote.byNameWithUUID
|
||||
from <- getOptionField fromOption Remote.byNameWithUUID
|
||||
|
|
|
@ -18,13 +18,15 @@ import Annex.Transfer
|
|||
import Logs.Presence
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions moveOptions $ command "move" paramPaths seek
|
||||
SectionCommon "move content of files to/from another repository"
|
||||
cmd = withOptions moveOptions $
|
||||
command "move" SectionCommon
|
||||
"move content of files to/from another repository"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
moveOptions :: [Option]
|
||||
moveOptions = fromToOptions ++ [jobsOption] ++ keyOptions ++ annexedMatchingOptions
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
to <- getOptionField toOption Remote.byNameWithUUID
|
||||
from <- getOptionField fromOption Remote.byNameWithUUID
|
||||
|
|
|
@ -20,9 +20,10 @@ import Control.Concurrent.Async
|
|||
import Control.Concurrent.STM
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "notifychanges" paramNothing SectionPlumbing
|
||||
"sends notification when git refs are changed"
|
||||
(commandParser seek)
|
||||
cmd = noCommit $
|
||||
command "notifychanges" SectionPlumbing
|
||||
"sends notification when git refs are changed"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
|
|
@ -14,10 +14,11 @@ import Annex.NumCopies
|
|||
import Types.Messages
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "numcopies" paramNumber seek
|
||||
SectionSetup "configure desired number of copies"
|
||||
cmd = command "numcopies" SectionSetup
|
||||
"configure desired number of copies"
|
||||
paramNumber (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -29,9 +29,10 @@ import qualified Git.LsFiles as Git
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "pre-commit" paramPaths SectionPlumbing
|
||||
cmd = command "pre-commit" SectionPlumbing
|
||||
"run by git pre-commit hook"
|
||||
(commandParser seek)
|
||||
paramPaths
|
||||
(withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = lockPreCommitHook $ ifM isDirect
|
||||
|
|
|
@ -19,10 +19,11 @@ import qualified Git.Branch
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $
|
||||
command "proxy" ("-- git command") seek
|
||||
SectionPlumbing "safely bypass direct mode guard"
|
||||
command "proxy" SectionPlumbing
|
||||
"safely bypass direct mode guard"
|
||||
("-- git command") (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -19,11 +19,13 @@ import Utility.CopyFile
|
|||
import qualified Remote
|
||||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ command "rekey"
|
||||
(paramRepeating $ paramPair paramPath paramKey)
|
||||
seek SectionPlumbing "change keys used for files"
|
||||
cmd = notDirect $
|
||||
command "rekey" SectionPlumbing
|
||||
"change keys used for files"
|
||||
(paramRepeating $ paramPair paramPath paramKey)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withPairs start
|
||||
|
||||
start :: (FilePath, String) -> CommandStart
|
||||
|
|
|
@ -13,10 +13,13 @@ import Logs.Location
|
|||
import Types.Key
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "readpresentkey" (paramPair paramKey paramUUID) seek
|
||||
SectionPlumbing "read records of where key is present"
|
||||
cmd = noCommit $
|
||||
command "readpresentkey" SectionPlumbing
|
||||
"read records of where key is present"
|
||||
(paramPair paramKey paramUUID)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -21,9 +21,9 @@ import qualified Types.Backend
|
|||
import qualified Backend
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "recvkey" paramKey
|
||||
SectionPlumbing "runs rsync in server mode to receive content"
|
||||
(commandParser seek)
|
||||
cmd = noCommit $ command "recvkey" SectionPlumbing
|
||||
"runs rsync in server mode to receive content"
|
||||
paramKey (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withKeys start
|
||||
|
|
|
@ -17,10 +17,12 @@ import Command.FromKey (mkKey)
|
|||
|
||||
cmd :: Command
|
||||
cmd = notDirect $ notBareRepo $
|
||||
command "registerurl" (paramPair paramKey paramUrl) seek
|
||||
command "registerurl"
|
||||
SectionPlumbing "registers an url for a key"
|
||||
(paramPair paramKey paramUrl)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -14,12 +14,14 @@ import Annex.UUID
|
|||
import Types.UUID
|
||||
import qualified Remote
|
||||
|
||||
cmd :: [Command]
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $
|
||||
command "reinit" (paramUUID ++ "|" ++ paramDesc) seek
|
||||
SectionUtility "initialize repository, reusing old UUID"
|
||||
command "reinit" SectionUtility
|
||||
"initialize repository, reusing old UUID"
|
||||
(paramUUID ++ "|" ++ paramDesc)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -14,11 +14,12 @@ import Annex.Content
|
|||
import qualified Command.Fsck
|
||||
import qualified Backend
|
||||
|
||||
cmd :: [Command]
|
||||
cmd = command "reinject" (paramPair "SRC" "DEST") seek
|
||||
SectionUtility "sets content of annexed file"
|
||||
cmd :: Command
|
||||
cmd = command "reinject" SectionUtility
|
||||
"sets content of annexed file"
|
||||
(paramPair "SRC" "DEST") (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [FilePath] -> CommandStart
|
||||
|
|
|
@ -12,10 +12,12 @@ import Command
|
|||
import RemoteDaemon.Core
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "remotedaemon" paramNothing seek SectionPlumbing
|
||||
"detects when remotes have changed, and fetches from them"
|
||||
cmd = noCommit $
|
||||
command "remotedaemon" SectionPlumbing
|
||||
"detects when remotes have changed, and fetches from them"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -18,9 +18,11 @@ import Annex.Version
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ dontCheck repoExists $
|
||||
command "repair" paramNothing seek SectionMaintenance "recover broken git repository"
|
||||
command "repair" SectionMaintenance
|
||||
"recover broken git repository"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -15,10 +15,11 @@ import qualified Git.Branch
|
|||
import Annex.AutoMerge
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "resolvemerge" paramNothing seek SectionPlumbing
|
||||
cmd = command "resolvemerge" SectionPlumbing
|
||||
"resolve merge conflicts"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -15,10 +15,12 @@ import qualified Remote
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $
|
||||
command "rmurl" (paramPair paramFile paramUrl) seek
|
||||
SectionCommon "record file is not available at url"
|
||||
command "rmurl" SectionCommon
|
||||
"record file is not available at url"
|
||||
(paramPair paramFile paramUrl)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withPairs start
|
||||
|
||||
start :: (FilePath, String) -> CommandStart
|
||||
|
|
|
@ -18,10 +18,11 @@ import Types.Messages
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "schedule" (paramPair paramRemote (paramOptional paramExpression)) seek
|
||||
SectionSetup "get or set scheduled jobs"
|
||||
cmd = command "schedule" SectionSetup "get or set scheduled jobs"
|
||||
(paramPair paramRemote (paramOptional paramExpression))
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -12,8 +12,9 @@ import Types.TrustLevel
|
|||
import Command.Trust (trustCommand)
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "semitrust" (paramRepeating paramRemote) seek
|
||||
SectionSetup "return repository to default trust level"
|
||||
cmd = command "semitrust" SectionSetup
|
||||
"return repository to default trust level"
|
||||
(paramRepeating paramRemote) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = trustCommand "semitrust" SemiTrusted
|
||||
|
|
|
@ -17,9 +17,10 @@ import qualified CmdLine.GitAnnexShell.Fields as Fields
|
|||
import Utility.Metered
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "sendkey" paramKey
|
||||
SectionPlumbing "runs rsync in server mode to send content"
|
||||
(commandParser seek)
|
||||
cmd = noCommit $
|
||||
command "sendkey" SectionPlumbing
|
||||
"runs rsync in server mode to send content"
|
||||
paramKey (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withKeys start
|
||||
|
|
|
@ -14,10 +14,11 @@ import Annex.Content
|
|||
import Types.Key
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "setkey" (paramPair paramKey paramPath) seek
|
||||
SectionPlumbing "sets annexed content for a key"
|
||||
cmd = command "setkey" SectionPlumbing "sets annexed content for a key"
|
||||
(paramPair paramKey paramPath)
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -14,10 +14,13 @@ import Logs.Presence.Pure
|
|||
import Types.Key
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "setpresentkey" (paramPair paramKey (paramPair paramUUID "[1|0]")) seek
|
||||
SectionPlumbing "change records of where key is present"
|
||||
cmd = noCommit $
|
||||
command "setpresentkey" SectionPlumbing
|
||||
"change records of where key is present"
|
||||
(paramPair paramKey (paramPair paramUUID "[1|0]"))
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -18,10 +18,11 @@ import qualified Git
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ noCommit $ noMessages $ withOptions [jsonOption] $
|
||||
command "status" paramPaths seek SectionCommon
|
||||
command "status" SectionCommon
|
||||
"show the working tree status"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [FilePath] -> CommandStart
|
||||
|
|
|
@ -53,8 +53,9 @@ import qualified Data.Map as M
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions syncOptions $
|
||||
command "sync" (paramRepeating paramRemote)
|
||||
seek SectionCommon "synchronize local repository with remotes"
|
||||
command "sync" SectionCommon
|
||||
"synchronize local repository with remotes"
|
||||
(paramRepeating paramRemote) (withParams seek)
|
||||
|
||||
syncOptions :: [Option]
|
||||
syncOptions =
|
||||
|
@ -69,7 +70,7 @@ contentOption = flagOption [] "content" "also transfer file contents"
|
|||
messageOption :: Option
|
||||
messageOption = fieldOption ['m'] "message" "MSG" "specify commit message"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek rs = do
|
||||
prepMerge
|
||||
|
||||
|
|
|
@ -13,10 +13,11 @@ import Messages
|
|||
|
||||
cmd :: Command
|
||||
cmd = noRepo startIO $ dontCheck repoExists $
|
||||
command "test" paramNothing seek SectionTesting
|
||||
command "test" SectionTesting
|
||||
"run built-in test suite"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
{- We don't actually run the test suite here because of a dependency loop.
|
||||
|
|
|
@ -38,13 +38,14 @@ import qualified Data.Map as M
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions [sizeOption] $
|
||||
command "testremote" paramRemote seek SectionTesting
|
||||
"test transfers to/from a remote"
|
||||
command "testremote" SectionTesting
|
||||
"test transfers to/from a remote"
|
||||
paramRemote (withParams seek)
|
||||
|
||||
sizeOption :: Option
|
||||
sizeOption = fieldOption [] "size" paramSize "base key size (default 1MiB)"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
basesz <- fromInteger . fromMaybe (1024 * 1024)
|
||||
<$> getOptionField sizeOption (pure . getsize)
|
||||
|
|
|
@ -16,9 +16,10 @@ import qualified CmdLine.GitAnnexShell.Fields as Fields
|
|||
import Utility.Metered
|
||||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ command "transferinfo" paramKey SectionPlumbing
|
||||
"updates sender on number of bytes of content received"
|
||||
(commandParser seek)
|
||||
cmd = noCommit $
|
||||
command "transferinfo" SectionPlumbing
|
||||
"updates sender on number of bytes of content received"
|
||||
paramKey (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
|
|
@ -16,9 +16,10 @@ import qualified Remote
|
|||
import Types.Remote
|
||||
|
||||
cmd :: Command
|
||||
cmd = withOptions transferKeyOptions $
|
||||
noCommit $ command "transferkey" paramKey seek SectionPlumbing
|
||||
cmd = withOptions transferKeyOptions $ noCommit $
|
||||
command "transferkey" SectionPlumbing
|
||||
"transfers a key from or to a remote"
|
||||
paramKey (withParams seek)
|
||||
|
||||
transferKeyOptions :: [Option]
|
||||
transferKeyOptions = fileOption : fromToOptions
|
||||
|
@ -26,7 +27,7 @@ transferKeyOptions = fileOption : fromToOptions
|
|||
fileOption :: Option
|
||||
fileOption = fieldOption [] "file" paramFile "the associated file"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
to <- getOptionField toOption Remote.byNameWithUUID
|
||||
from <- getOptionField fromOption Remote.byNameWithUUID
|
||||
|
|
|
@ -22,10 +22,10 @@ import Git.Types (RemoteName)
|
|||
data TransferRequest = TransferRequest Direction Remote Key AssociatedFile
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "transferkeys" paramNothing seek
|
||||
SectionPlumbing "transfers keys"
|
||||
cmd = command "transferkeys" SectionPlumbing "transfers keys"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -17,13 +17,13 @@ import Logs.Group
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "trust" (paramRepeating paramRemote) seek
|
||||
SectionSetup "trust a repository"
|
||||
cmd = command "trust" SectionSetup "trust a repository"
|
||||
(paramRepeating paramRemote) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = trustCommand "trust" Trusted
|
||||
|
||||
trustCommand :: String -> TrustLevel -> CommandSeek
|
||||
trustCommand :: String -> TrustLevel -> CmdParams -> CommandSeek
|
||||
trustCommand c level = withWords start
|
||||
where
|
||||
start ws = do
|
||||
|
|
|
@ -24,9 +24,9 @@ import Command.PreCommit (lockPreCommitHook)
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions annexedMatchingOptions $
|
||||
command "unannex" paramPaths SectionUtility
|
||||
command "unannex" SectionUtility
|
||||
"undo accidential add command"
|
||||
(commandParser seek)
|
||||
paramPaths (withParams seek)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = wrapUnannex . (withFilesInGit $ whenAnnexed start)
|
||||
|
|
|
@ -23,10 +23,11 @@ import qualified Command.Sync
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $
|
||||
command "undo" paramPaths seek
|
||||
SectionCommon "undo last change to a file or directory"
|
||||
command "undo" SectionCommon
|
||||
"undo last change to a file or directory"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
-- Safety first; avoid any undo that would touch files that are not
|
||||
-- in the index.
|
||||
|
|
|
@ -16,10 +16,10 @@ import Types.Group
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "ungroup" (paramPair paramRemote paramDesc) seek
|
||||
SectionSetup "remove a repository from a group"
|
||||
cmd = command "ungroup" SectionSetup "remove a repository from a group"
|
||||
(paramPair paramRemote paramDesc) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -22,9 +22,10 @@ import System.IO.HVFS
|
|||
import System.IO.HVFS.Utils
|
||||
|
||||
cmd :: Command
|
||||
cmd = addCheck check $ command "uninit" paramPaths
|
||||
SectionUtility "de-initialize git-annex and clean out repository"
|
||||
(commandParser seek)
|
||||
cmd = addCheck check $
|
||||
command "uninit" SectionUtility
|
||||
"de-initialize git-annex and clean out repository"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
check :: Annex ()
|
||||
check = do
|
||||
|
|
|
@ -20,10 +20,10 @@ editcmd :: Command
|
|||
editcmd = mkcmd "edit" "same as unlock"
|
||||
|
||||
mkcmd :: String -> String -> Command
|
||||
mkcmd n = notDirect . withOptions annexedMatchingOptions
|
||||
. command n paramPaths seek SectionCommon
|
||||
mkcmd n d = notDirect $ withOptions annexedMatchingOptions $
|
||||
command n SectionCommon d paramPaths (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withFilesInGit $ whenAnnexed start
|
||||
|
||||
{- The unlock subcommand replaces the symlink with a copy of the file's
|
||||
|
|
|
@ -12,8 +12,8 @@ import Types.TrustLevel
|
|||
import Command.Trust (trustCommand)
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "untrust" (paramRepeating paramRemote) seek
|
||||
SectionSetup "do not trust a repository"
|
||||
cmd = command "untrust" SectionSetup "do not trust a repository"
|
||||
(paramRepeating paramRemote) (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = trustCommand "untrust" UnTrusted
|
||||
|
|
|
@ -36,9 +36,9 @@ import Annex.BloomFilter
|
|||
|
||||
cmd :: Command
|
||||
cmd = withOptions [unusedFromOption, refSpecOption] $
|
||||
command "unused" paramNothing
|
||||
SectionMaintenance "look for unused file content"
|
||||
(commandParser seek)
|
||||
command "unused" SectionMaintenance
|
||||
"look for unused file content"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
unusedFromOption :: Option
|
||||
unusedFromOption = fieldOption ['f'] "from" paramRemote "remote to check for unused content"
|
||||
|
@ -268,7 +268,7 @@ data UnusedMaps = UnusedMaps
|
|||
, unusedTmpMap :: UnusedMap
|
||||
}
|
||||
|
||||
withUnusedMaps :: (UnusedMaps -> Int -> CommandStart) -> CommandSeek
|
||||
withUnusedMaps :: (UnusedMaps -> Int -> CommandStart) -> CmdParams -> CommandSeek
|
||||
withUnusedMaps a params = do
|
||||
unused <- readUnusedMap ""
|
||||
unusedbad <- readUnusedMap "bad"
|
||||
|
|
|
@ -13,10 +13,10 @@ import Upgrade
|
|||
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $ -- because an old version may not seem to exist
|
||||
command "upgrade" paramNothing seek
|
||||
SectionMaintenance "upgrade repository layout"
|
||||
command "upgrade" SectionMaintenance "upgrade repository layout"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -13,10 +13,13 @@ import Annex.View
|
|||
import Command.View (checkoutViewBranch)
|
||||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ notDirect $ command "vadd" (paramRepeating "FIELD=GLOB")
|
||||
seek SectionMetaData "add subdirs to current view"
|
||||
cmd = notBareRepo $ notDirect $
|
||||
command "vadd" SectionMetaData
|
||||
"add subdirs to current view"
|
||||
(paramRepeating "FIELD=GLOB")
|
||||
(withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -16,10 +16,11 @@ import Command.View (checkoutViewBranch)
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ notDirect $
|
||||
command "vcycle" paramNothing seek SectionMetaData
|
||||
"switch view to next layout"
|
||||
command "vcycle" SectionMetaData
|
||||
"switch view to next layout"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start ::CommandStart
|
||||
|
|
|
@ -14,9 +14,10 @@ import Command.View (paramView, checkoutViewBranch)
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ notDirect $
|
||||
command "vfilter" paramView seek SectionMetaData "filter current view"
|
||||
command "vfilter" SectionMetaData "filter current view"
|
||||
paramView (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -18,10 +18,10 @@ import Command.View (checkoutViewBranch)
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ notDirect $
|
||||
command "vpop" paramNumber seek SectionMetaData
|
||||
"switch back to previous view"
|
||||
command "vpop" SectionMetaData "switch back to previous view"
|
||||
paramNumber (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
|
@ -20,12 +20,13 @@ import qualified Backend
|
|||
cmd :: Command
|
||||
cmd = withOptions [rawOption] $
|
||||
noCommit $ noRepo startNoRepo $ dontCheck repoExists $
|
||||
command "version" paramNothing seek SectionQuery "show version info"
|
||||
command "version" SectionQuery "show version info"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
rawOption :: Option
|
||||
rawOption = flagOption [] "raw" "output only program version"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing $ ifM (getOptionFlag rawOption) (startRaw, start)
|
||||
|
||||
startRaw :: CommandStart
|
||||
|
|
|
@ -30,10 +30,10 @@ import Types.ScheduledActivity
|
|||
import Remote
|
||||
|
||||
cmd :: Command
|
||||
cmd = command "vicfg" paramNothing seek
|
||||
SectionSetup "edit git-annex's configuration"
|
||||
cmd = command "vicfg" SectionSetup "edit git-annex's configuration"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withNothing start
|
||||
|
||||
start :: CommandStart
|
||||
|
|
|
@ -19,16 +19,17 @@ import Logs.View
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ notDirect $
|
||||
command "view" paramView seek SectionMetaData "enter a view branch"
|
||||
command "view" SectionMetaData "enter a view branch"
|
||||
paramView (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
start [] = error "Specify metadata to include in view"
|
||||
start params = do
|
||||
start ps = do
|
||||
showStart "view" ""
|
||||
view <- mkView params
|
||||
view <- mkView ps
|
||||
go view =<< currentView
|
||||
where
|
||||
go view Nothing = next $ perform view
|
||||
|
@ -45,11 +46,11 @@ paramView :: String
|
|||
paramView = paramRepeating "FIELD=VALUE"
|
||||
|
||||
mkView :: [String] -> Annex View
|
||||
mkView params = go =<< inRepo Git.Branch.current
|
||||
mkView ps = go =<< inRepo Git.Branch.current
|
||||
where
|
||||
go Nothing = error "not on any branch!"
|
||||
go (Just b) = return $ fst $ refineView (View b []) $
|
||||
map parseViewParam $ reverse params
|
||||
map parseViewParam $ reverse ps
|
||||
|
||||
checkoutViewBranch :: View -> (View -> Annex Git.Branch) -> CommandCleanup
|
||||
checkoutViewBranch view mkbranch = do
|
||||
|
|
|
@ -28,7 +28,7 @@ cmd'
|
|||
-> Annex (M.Map UUID PreferredContentExpression)
|
||||
-> (UUID -> PreferredContentExpression -> Annex ())
|
||||
-> Command
|
||||
cmd' name desc getter setter = command name pdesc seek SectionSetup desc
|
||||
cmd' name desc getter setter = command name SectionSetup desc pdesc (withParams seek)
|
||||
where
|
||||
pdesc = paramPair paramRemote (paramOptional paramExpression)
|
||||
|
||||
|
|
|
@ -14,9 +14,11 @@ import Utility.HumanTime
|
|||
|
||||
cmd :: Command
|
||||
cmd = notBareRepo $ withOptions [foregroundOption, stopOption] $
|
||||
command "watch" paramNothing seek SectionCommon "watch for changes and autocommit"
|
||||
command "watch" SectionCommon
|
||||
"watch for changes and autocommit"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
stopdaemon <- getOptionFlag stopOption
|
||||
foreground <- getOptionFlag foregroundOption
|
||||
|
|
|
@ -40,13 +40,14 @@ import System.Environment (getArgs)
|
|||
cmd :: Command
|
||||
cmd = withOptions [listenOption] $
|
||||
noCommit $ noRepo startNoRepo $ dontCheck repoExists $ notBareRepo $
|
||||
command "webapp" paramNothing seek SectionCommon "launch webapp"
|
||||
command "webapp" SectionCommon "launch webapp"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
listenOption :: Option
|
||||
listenOption = fieldOption [] "listen" paramAddress
|
||||
"accept connections to this address"
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
listenhost <- getOptionField listenOption return
|
||||
withNothing (start listenhost) ps
|
||||
|
|
|
@ -17,10 +17,11 @@ import Logs.Web
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ withOptions (jsonOption : annexedMatchingOptions ++ keyOptions) $
|
||||
command "whereis" paramPaths seek SectionQuery
|
||||
command "whereis" SectionQuery
|
||||
"lists repositories that have file content"
|
||||
paramPaths (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek ps = do
|
||||
m <- remoteMap id
|
||||
withKeyOptions False
|
||||
|
|
|
@ -13,10 +13,10 @@ import Assistant.XMPP.Git
|
|||
|
||||
cmd :: Command
|
||||
cmd = noCommit $ noRepo startNoRepo $ dontCheck repoExists $
|
||||
command "xmppgit" paramNothing seek
|
||||
SectionPlumbing "git to XMPP relay"
|
||||
command "xmppgit" SectionPlumbing "git to XMPP relay"
|
||||
paramNothing (withParams seek)
|
||||
|
||||
seek :: CommandSeek
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue