add section metadata to all commands

Not yet used .. mindless train work.
This commit is contained in:
Joey Hess 2013-03-24 18:28:21 -04:00
parent 2ea720abc9
commit cfd3b16fe1
59 changed files with 86 additions and 59 deletions

View file

@ -40,7 +40,7 @@ import Config
import Annex.CheckAttr
{- Generates a normal command -}
command :: String -> String -> [CommandSeek] -> String -> Command
command :: String -> String -> [CommandSeek] -> CommandSection -> String -> Command
command = Command [] Nothing commonChecks False
{- Indicates that a command doesn't need to commit any changes to

View file

@ -29,7 +29,8 @@ import Config
import Utility.InodeCache
def :: [Command]
def = [notBareRepo $ command "add" paramPaths seek "add files to annex"]
def = [notBareRepo $ command "add" paramPaths seek SectionCommon
"add files to annex"]
{- Add acts on both files not checked into git yet, and unlocked files.
-

View file

@ -15,7 +15,7 @@ import Types.Key
def :: [Command]
def = [notDirect $ command "addunused" (paramRepeating paramNumRange)
seek "add back unused files"]
seek SectionMaintenance "add back unused files"]
seek :: [CommandSeek]
seek = [withUnusedMaps start]

View file

@ -26,7 +26,8 @@ import Annex.Content.Direct
def :: [Command]
def = [notBareRepo $ withOptions [fileOption, pathdepthOption, relaxedOption] $
command "addurl" (paramRepeating paramUrl) seek "add urls to annex"]
command "addurl" (paramRepeating paramUrl) seek
SectionCommon "add urls to annex"]
fileOption :: Option
fileOption = Option.field [] "file" paramFile "specify what file the url is added to"

View file

@ -20,7 +20,8 @@ import System.Posix.Directory
def :: [Command]
def = [noRepo checkAutoStart $ dontCheck repoExists $
withOptions [Command.Watch.foregroundOption, Command.Watch.stopOption, autoStartOption] $
command "assistant" paramNothing seek "automatically handle changes"]
command "assistant" paramNothing seek SectionCommon
"automatically handle changes"]
autoStartOption :: Option
autoStartOption = Option.flag [] "autostart" "start in known repositories"

View file

@ -14,7 +14,7 @@ import qualified Git
def :: [Command]
def = [command "commit" paramNothing seek
"commits any staged changes to the git-annex branch"]
SectionPlumbing "commits any staged changes to the git-annex branch"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -13,7 +13,7 @@ import Annex.UUID
def :: [Command]
def = [noCommit $ command "configlist" paramNothing seek
"outputs relevant git configuration"]
SectionPlumbing "outputs relevant git configuration"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -15,7 +15,7 @@ import Annex.Wanted
def :: [Command]
def = [withOptions Command.Move.options $ command "copy" paramPaths seek
"copy content of files to/from another repository"]
SectionCommon "copy content of files to/from another repository"]
seek :: [CommandSeek]
seek = [withField Command.Move.toOption Remote.byNameWithUUID $ \to ->

View file

@ -17,7 +17,7 @@ import qualified Data.Set as S
def :: [Command]
def = [command "dead" (paramRepeating paramRemote) seek
"hide a lost repository"]
SectionSetup "hide a lost repository"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -14,7 +14,7 @@ import Logs.UUID
def :: [Command]
def = [command "describe" (paramPair paramRemote paramDesc) seek
"change description of a repository"]
SectionSetup "change description of a repository"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -18,7 +18,8 @@ import Annex.Version
def :: [Command]
def = [notBareRepo $
command "direct" paramNothing seek "switch repository to direct mode"]
command "direct" paramNothing seek
SectionSetup "switch repository to direct mode"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -21,7 +21,7 @@ import Annex.Wanted
def :: [Command]
def = [withOptions [fromOption] $ command "drop" paramPaths seek
"indicate content of files not currently wanted"]
SectionCommon "indicate content of files not currently wanted"]
fromOption :: Option
fromOption = Option.field ['f'] "from" paramRemote "drop content from a remote"

View file

@ -16,7 +16,7 @@ import Types.Key
def :: [Command]
def = [noCommit $ command "dropkey" (paramRepeating paramKey) seek
"drops annexed content for specified keys"]
SectionPlumbing "drops annexed content for specified keys"]
seek :: [CommandSeek]
seek = [withKeys start]

View file

@ -19,7 +19,7 @@ import qualified Option
def :: [Command]
def = [withOptions [Command.Drop.fromOption] $
command "dropunused" (paramRepeating paramNumRange)
seek "drop unused file content"]
seek SectionMaintenance "drop unused file content"]
seek :: [CommandSeek]
seek = [withUnusedMaps start]

View file

@ -21,7 +21,7 @@ import qualified Option
def :: [Command]
def = [noCommit $ withOptions [formatOption, print0Option] $
command "find" paramPaths seek "lists available files"]
command "find" paramPaths seek SectionQuery "lists available files"]
formatOption :: Option
formatOption = Option.field [] "format" paramFormat "control format of output"

View file

@ -14,7 +14,7 @@ import Annex.Content
def :: [Command]
def = [notDirect $ noCommit $ command "fix" paramPaths seek
"fix up symlinks to point to annexed content"]
SectionMaintenance "fix up symlinks to point to annexed content"]
seek :: [CommandSeek]
seek = [withFilesInGit $ whenAnnexed start]

View file

@ -16,7 +16,7 @@ import Types.Key
def :: [Command]
def = [notDirect $ notBareRepo $
command "fromkey" (paramPair paramKey paramPath) seek
"adds a file using a specific key"]
SectionPlumbing "adds a file using a specific key"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -36,7 +36,7 @@ import System.Locale
def :: [Command]
def = [withOptions options $ command "fsck" paramPaths seek
"check for problems"]
SectionMaintenance "check for problems"]
fromOption :: Option
fromOption = Option.field ['f'] "from" paramRemote "check remote"

View file

@ -17,7 +17,7 @@ import Annex.Wanted
def :: [Command]
def = [withOptions [Command.Move.fromOption] $ command "get" paramPaths seek
"make content of annexed files available"]
SectionCommon "make content of annexed files available"]
seek :: [CommandSeek]
seek = [withField Command.Move.fromOption Remote.byNameWithUUID $ \from ->

View file

@ -16,7 +16,8 @@ import Types.Group
import qualified Data.Set as S
def :: [Command]
def = [command "group" (paramPair paramRemote paramDesc) seek "add a repository to a group"]
def = [command "group" (paramPair paramRemote paramDesc) seek
SectionCommon "add a repository to a group"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -21,7 +21,7 @@ import qualified Command.Fsck
def :: [Command]
def = [noCommit $ noRepo showHelp $ dontCheck repoExists $
command "help" paramNothing seek "display help"]
command "help" paramNothing seek SectionUtility "display help"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -14,7 +14,7 @@ import qualified Command.Add
def :: [Command]
def = [notDirect $ notBareRepo $ command "import" paramPaths seek
"move and add files from outside git working copy"]
SectionCommon "move and add files from outside git working copy"]
seek :: [CommandSeek]
seek = [withPathContents start]

View file

@ -13,7 +13,7 @@ import Annex.Content
def :: [Command]
def = [noCommit $ command "inannex" (paramRepeating paramKey) seek
"checks if keys are present in the annex"]
SectionPlumbing "checks if keys are present in the annex"]
seek :: [CommandSeek]
seek = [withKeys start]

View file

@ -22,7 +22,7 @@ import Init
def :: [Command]
def = [notBareRepo $ command "indirect" paramNothing seek
"switch repository to indirect mode"]
SectionSetup "switch repository to indirect mode"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -13,7 +13,7 @@ import Init
def :: [Command]
def = [dontCheck repoExists $
command "init" paramDesc seek "initialize git-annex"]
command "init" paramDesc seek SectionSetup "initialize git-annex"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -20,7 +20,7 @@ import Logs.UUID
def :: [Command]
def = [command "initremote"
(paramPair paramName $ paramOptional $ paramRepeating paramKeyValue)
seek "sets up a special (non-git) remote"]
seek SectionSetup "sets up a special (non-git) remote"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -12,7 +12,8 @@ import Command
import qualified Annex.Queue
def :: [Command]
def = [notDirect $ command "lock" paramPaths seek "undo unlock command"]
def = [notDirect $ command "lock" paramPaths seek SectionCommon
"undo unlock command"]
seek :: [CommandSeek]
seek = [withFilesUnlocked start, withFilesUnlockedToBeCommitted start]

View file

@ -37,7 +37,7 @@ type Outputter = Bool -> POSIXTime -> [UUID] -> Annex ()
def :: [Command]
def = [withOptions options $
command "log" paramPaths seek "shows location log"]
command "log" paramPaths seek SectionQuery "shows location log"]
options :: [Option]
options = passthruOptions ++ [gourceOption]

View file

@ -28,7 +28,8 @@ data Link = Link Git.Repo Git.Repo
def :: [Command]
def = [dontCheck repoExists $
command "map" paramNothing seek "generate map of repositories"]
command "map" paramNothing seek SectionQuery
"generate map of repositories"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -12,8 +12,8 @@ import Command
import qualified Annex.Branch
def :: [Command]
def = [command "merge" paramNothing seek
"auto-merge remote changes into git-annex branch"]
def = [command "merge" paramNothing seek SectionMaintenance
"auto-merge remote changes into git-annex branch"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -19,7 +19,8 @@ import qualified Command.Fsck
def :: [Command]
def = [notDirect $
command "migrate" paramPaths seek "switch data to different backend"]
command "migrate" paramPaths seek
SectionUtility "switch data to different backend"]
seek :: [CommandSeek]
seek = [withFilesInGit $ whenAnnexed start]

View file

@ -20,7 +20,7 @@ import Logs.Transfer
def :: [Command]
def = [withOptions options $ command "move" paramPaths seek
"move content of files to/from another repository"]
SectionCommon "move content of files to/from another repository"]
fromOption :: Option
fromOption = Option.field ['f'] "from" paramRemote "source remote"

View file

@ -17,7 +17,8 @@ import Annex.Content.Direct
import Git.Sha
def :: [Command]
def = [command "pre-commit" paramPaths seek "run by git pre-commit hook"]
def = [command "pre-commit" paramPaths seek SectionPlumbing
"run by git pre-commit hook"]
seek :: [CommandSeek]
seek =

View file

@ -20,7 +20,7 @@ import Utility.CopyFile
def :: [Command]
def = [notDirect $ command "rekey"
(paramOptional $ paramRepeating $ paramPair paramPath paramKey)
seek "change keys used for files"]
seek SectionPlumbing "change keys used for files"]
seek :: [CommandSeek]
seek = [withPairs start]

View file

@ -21,7 +21,7 @@ import qualified Backend
def :: [Command]
def = [noCommit $ command "recvkey" paramKey seek
"runs rsync in server mode to receive content"]
SectionPlumbing "runs rsync in server mode to receive content"]
seek :: [CommandSeek]
seek = [withKeys start]

View file

@ -15,7 +15,7 @@ import qualified Command.Fsck
def :: [Command]
def = [notDirect $ command "reinject" (paramPair "SRC" "DEST") seek
"sets content of annexed file"]
SectionUtility "sets content of annexed file"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -14,7 +14,7 @@ import Logs.Trust
def :: [Command]
def = [command "semitrust" (paramRepeating paramRemote) seek
"return repository to default trust level"]
SectionSetup "return repository to default trust level"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -16,7 +16,7 @@ import qualified Fields
def :: [Command]
def = [noCommit $ command "sendkey" paramKey seek
"runs rsync in server mode to send content"]
SectionPlumbing "runs rsync in server mode to send content"]
seek :: [CommandSeek]
seek = [withKeys start]

View file

@ -58,7 +58,7 @@ type StatState = StateT StatInfo Annex
def :: [Command]
def = [command "status" (paramOptional paramPaths) seek
"shows status information about the annex"]
SectionQuery "shows status information about the annex"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -34,7 +34,7 @@ import Data.Hash.MD5
def :: [Command]
def = [command "sync" (paramOptional (paramRepeating paramRemote))
[seek] "synchronize local repository with remotes"]
[seek] SectionCommon "synchronize local repository with remotes"]
-- syncing involves several operations, any of which can independently fail
seek :: CommandSeek

View file

@ -11,7 +11,8 @@ import Command
def :: [Command]
def = [ dontCheck repoExists $
command "test" paramNothing seek "run built-in test suite"]
command "test" paramNothing seek SectionPlumbing
"run built-in test suite"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -15,7 +15,7 @@ import Types.Key
import qualified Fields
def :: [Command]
def = [noCommit $ command "transferinfo" paramKey seek
def = [noCommit $ command "transferinfo" paramKey seek SectionPlumbing
"updates sender on number of bytes of content received"]
seek :: [CommandSeek]

View file

@ -20,7 +20,7 @@ import qualified Option
def :: [Command]
def = [withOptions options $
noCommit $ command "transferkey" paramKey seek
noCommit $ command "transferkey" paramKey seek SectionPlumbing
"transfers a key from or to a remote"]
options :: [Option]

View file

@ -23,7 +23,8 @@ data TransferRequest = TransferRequest Direction Remote Key AssociatedFile
def :: [Command]
def = [withOptions options $
command "transferkeys" paramNothing seek "plumbing; transfers keys"]
command "transferkeys" paramNothing seek
SectionPlumbing "transfers keys"]
options :: [Option]
options = [readFdOption, writeFdOption]

View file

@ -13,7 +13,8 @@ import qualified Remote
import Logs.Trust
def :: [Command]
def = [command "trust" (paramRepeating paramRemote) seek "trust a repository"]
def = [command "trust" (paramRepeating paramRemote) seek
SectionSetup "trust a repository"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -17,7 +17,8 @@ import qualified Git.LsFiles as LsFiles
def :: [Command]
def = [notDirect $
command "unannex" paramPaths seek "undo accidential add command"]
command "unannex" paramPaths seek SectionUtility
"undo accidential add command"]
seek :: [CommandSeek]
seek = [withFilesInGit $ whenAnnexed start]

View file

@ -16,7 +16,8 @@ import Types.Group
import qualified Data.Set as S
def :: [Command]
def = [command "ungroup" (paramPair paramRemote paramDesc) seek "remove a repository from a group"]
def = [command "ungroup" (paramPair paramRemote paramDesc) seek
SectionSetup "remove a repository from a group"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -19,7 +19,7 @@ import Annex.Content
def :: [Command]
def = [notDirect $ addCheck check $ command "uninit" paramPaths seek
"de-initialize git-annex and clean out repository"]
SectionUtility "de-initialize git-annex and clean out repository"]
check :: Annex ()
check = do

View file

@ -18,7 +18,7 @@ def =
, c "edit" "same as unlock"
]
where
c n = notDirect . command n paramPaths seek
c n = notDirect . command n paramPaths seek SectionCommon
seek :: [CommandSeek]
seek = [withFilesInGit $ whenAnnexed start]

View file

@ -14,7 +14,7 @@ import Logs.Trust
def :: [Command]
def = [command "untrust" (paramRepeating paramRemote) seek
"do not trust a repository"]
SectionSetup "do not trust a repository"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -37,7 +37,7 @@ import Types.Key
def :: [Command]
def = [withOptions [fromOption] $ command "unused" paramNothing seek
"look for unused file content"]
SectionMaintenance "look for unused file content"]
fromOption :: Option
fromOption = Option.field ['f'] "from" paramRemote "remote to check for unused content"

View file

@ -14,7 +14,8 @@ import Annex.Version
def :: [Command]
def = [dontCheck repoExists $ -- because an old version may not seem to exist
command "upgrade" paramNothing seek "upgrade repository layout"]
command "upgrade" paramNothing seek
SectionMaintenance "upgrade repository layout"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -15,7 +15,7 @@ import BuildFlags
def :: [Command]
def = [noCommit $ noRepo showPackageVersion $ dontCheck repoExists $
command "version" paramNothing seek "show version info"]
command "version" paramNothing seek SectionQuery "show version info"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -25,7 +25,7 @@ import Remote
def :: [Command]
def = [command "vicfg" paramNothing seek
"edit git-annex's configuration"]
SectionSetup "edit git-annex's configuration"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -14,7 +14,7 @@ import Option
def :: [Command]
def = [notBareRepo $ withOptions [foregroundOption, stopOption] $
command "watch" paramNothing seek "watch for changes"]
command "watch" paramNothing seek SectionCommon "watch for changes"]
seek :: [CommandSeek]
seek = [withFlag stopOption $ \stopdaemon ->

View file

@ -31,7 +31,7 @@ import System.Process (env, std_out, std_err)
def :: [Command]
def = [noCommit $ noRepo startNoRepo $ dontCheck repoExists $ notBareRepo $
command "webapp" paramNothing seek "launch webapp"]
command "webapp" paramNothing seek SectionCommon "launch webapp"]
seek :: [CommandSeek]
seek = [withNothing start]

View file

@ -16,7 +16,7 @@ import Logs.Trust
def :: [Command]
def = [noCommit $ command "whereis" paramPaths seek
"lists repositories that have file content"]
SectionQuery "lists repositories that have file content"]
seek :: [CommandSeek]
seek = [withValue (remoteMap id) $ \m ->

View file

@ -13,7 +13,8 @@ import Assistant.XMPP.Git
def :: [Command]
def = [noCommit $ noRepo xmppGitRelay $ dontCheck repoExists $
command "xmppgit" paramNothing seek "git to XMPP relay (internal use)"]
command "xmppgit" paramNothing seek
SectionPlumbing "git to XMPP relay"]
seek :: [CommandSeek]
seek = [withWords start]

View file

@ -42,6 +42,7 @@ data Command = Command
, cmdname :: String
, cmdparamdesc :: String -- description of params for usage
, cmdseek :: [CommandSeek] -- seek stage
, cmdsection :: CommandSection
, cmddesc :: String -- description of command for usage
}
@ -55,3 +56,13 @@ instance Eq Command where
{- Order commands by name -}
instance Ord Command where
compare = comparing cmdname
{- The same sections are listed in doc/git-annex.mdwn -}
data CommandSection
= SectionCommon
| SectionSetup
| SectionMaintenance
| SectionQuery
| SectionUtility
| SectionPlumbing
deriving (Eq, Ord, Enum, Bounded)