support subcommands that take no params
This commit is contained in:
parent
df4b461df1
commit
cc4794ce85
2 changed files with 9 additions and 2 deletions
10
CmdLine.hs
10
CmdLine.hs
|
@ -32,6 +32,7 @@ import qualified Command.DropKey
|
||||||
import qualified Command.SetKey
|
import qualified Command.SetKey
|
||||||
import qualified Command.Fix
|
import qualified Command.Fix
|
||||||
import qualified Command.Init
|
import qualified Command.Init
|
||||||
|
import qualified Command.Fsck
|
||||||
|
|
||||||
subCmds :: [SubCommand]
|
subCmds :: [SubCommand]
|
||||||
subCmds = [
|
subCmds = [
|
||||||
|
@ -47,8 +48,6 @@ subCmds = [
|
||||||
"initialize git-annex with repository description")
|
"initialize git-annex with repository description")
|
||||||
, (SubCommand "unannex" path (withFilesInGit Command.Unannex.start)
|
, (SubCommand "unannex" path (withFilesInGit Command.Unannex.start)
|
||||||
"undo accidential add command")
|
"undo accidential add command")
|
||||||
, (SubCommand "fix" path (withFilesInGit Command.Fix.start)
|
|
||||||
"fix up symlinks to point to annexed content")
|
|
||||||
, (SubCommand "pre-commit" path (withFilesToBeCommitted Command.Fix.start)
|
, (SubCommand "pre-commit" path (withFilesToBeCommitted Command.Fix.start)
|
||||||
"fix up symlinks before they are committed")
|
"fix up symlinks before they are committed")
|
||||||
, (SubCommand "fromkey" key (withFilesMissing Command.FromKey.start)
|
, (SubCommand "fromkey" key (withFilesMissing Command.FromKey.start)
|
||||||
|
@ -57,11 +56,16 @@ subCmds = [
|
||||||
"drops annexed content for specified keys")
|
"drops annexed content for specified keys")
|
||||||
, (SubCommand "setkey" key (withTempFile Command.SetKey.start)
|
, (SubCommand "setkey" key (withTempFile Command.SetKey.start)
|
||||||
"sets annexed content for a key using a temp file")
|
"sets annexed content for a key using a temp file")
|
||||||
|
, (SubCommand "fix" path (withFilesInGit Command.Fix.start)
|
||||||
|
"fix up symlinks to point to annexed content")
|
||||||
|
, (SubCommand "fsck" nothing (withNothing Command.Fsck.start)
|
||||||
|
"check annex for problems")
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
path = "PATH ..."
|
path = "PATH ..."
|
||||||
key = "KEY ..."
|
key = "KEY ..."
|
||||||
desc = "DESCRIPTION"
|
desc = "DESCRIPTION"
|
||||||
|
nothing = ""
|
||||||
|
|
||||||
-- Each dashed command-line option results in generation of an action
|
-- Each dashed command-line option results in generation of an action
|
||||||
-- in the Annex monad that performs the necessary setting.
|
-- in the Annex monad that performs the necessary setting.
|
||||||
|
@ -137,6 +141,8 @@ withKeys :: SubCmdSeekStrings
|
||||||
withKeys a params = return $ map a params
|
withKeys a params = return $ map a params
|
||||||
withTempFile :: SubCmdSeekStrings
|
withTempFile :: SubCmdSeekStrings
|
||||||
withTempFile a params = return $ map a params
|
withTempFile a params = return $ map a params
|
||||||
|
withNothing :: SubCmdSeekNothing
|
||||||
|
withNothing a params = return [a]
|
||||||
|
|
||||||
{- filter out files from the state directory -}
|
{- filter out files from the state directory -}
|
||||||
notState :: FilePath -> Bool
|
notState :: FilePath -> Bool
|
||||||
|
|
|
@ -36,6 +36,7 @@ type SubCmdSeekStrings = SubCmdStartString -> SubCmdSeek
|
||||||
type SubCmdStartString = String -> SubCmdStart
|
type SubCmdStartString = String -> SubCmdStart
|
||||||
type SubCmdSeekBackendFiles = SubCmdStartBackendFile -> SubCmdSeek
|
type SubCmdSeekBackendFiles = SubCmdStartBackendFile -> SubCmdSeek
|
||||||
type SubCmdStartBackendFile = (FilePath, Maybe Backend) -> SubCmdStart
|
type SubCmdStartBackendFile = (FilePath, Maybe Backend) -> SubCmdStart
|
||||||
|
type SubCmdSeekNothing = SubCmdStart -> SubCmdSeek
|
||||||
|
|
||||||
data SubCommand = SubCommand {
|
data SubCommand = SubCommand {
|
||||||
subcmdname :: String,
|
subcmdname :: String,
|
||||||
|
|
Loading…
Reference in a new issue