summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-04 13:37:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-04 13:37:06 -0400
commitcc4794ce85f8e8e511a4aadb62db53bfff35ca8d (patch)
treef02ab1d25c7e902b3eb040ea908b3c43d85677d6
parentdf4b461df1bf70016ffa02d08e822067f8544a63 (diff)
support subcommands that take no params
-rw-r--r--CmdLine.hs10
-rw-r--r--Command.hs1
2 files changed, 9 insertions, 2 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 98bdab12f..e03c4d4c6 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -32,6 +32,7 @@ import qualified Command.DropKey
import qualified Command.SetKey
import qualified Command.Fix
import qualified Command.Init
+import qualified Command.Fsck
subCmds :: [SubCommand]
subCmds = [
@@ -47,8 +48,6 @@ subCmds = [
"initialize git-annex with repository description")
, (SubCommand "unannex" path (withFilesInGit Command.Unannex.start)
"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)
"fix up symlinks before they are committed")
, (SubCommand "fromkey" key (withFilesMissing Command.FromKey.start)
@@ -57,11 +56,16 @@ subCmds = [
"drops annexed content for specified keys")
, (SubCommand "setkey" key (withTempFile Command.SetKey.start)
"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
path = "PATH ..."
key = "KEY ..."
desc = "DESCRIPTION"
+ nothing = ""
-- Each dashed command-line option results in generation of an action
-- in the Annex monad that performs the necessary setting.
@@ -137,6 +141,8 @@ withKeys :: SubCmdSeekStrings
withKeys a params = return $ map a params
withTempFile :: SubCmdSeekStrings
withTempFile a params = return $ map a params
+withNothing :: SubCmdSeekNothing
+withNothing a params = return [a]
{- filter out files from the state directory -}
notState :: FilePath -> Bool
diff --git a/Command.hs b/Command.hs
index 47c73370f..d557651aa 100644
--- a/Command.hs
+++ b/Command.hs
@@ -36,6 +36,7 @@ type SubCmdSeekStrings = SubCmdStartString -> SubCmdSeek
type SubCmdStartString = String -> SubCmdStart
type SubCmdSeekBackendFiles = SubCmdStartBackendFile -> SubCmdSeek
type SubCmdStartBackendFile = (FilePath, Maybe Backend) -> SubCmdStart
+type SubCmdSeekNothing = SubCmdStart -> SubCmdSeek
data SubCommand = SubCommand {
subcmdname :: String,