summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-05 20:40:31 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-05 23:11:06 -0400
commit47be4383b714320c9e3f49cc23315101fad5735b (patch)
tree3a43aa41c43693ab9b66cc1b53a0d6dc0e1fb49e
parentcdcf0aac71bf6135d45b7f5d13342ed3d040596a (diff)
Command data structure tweaking
-rw-r--r--CmdLine.hs4
-rw-r--r--Types/Command.hs10
-rw-r--r--git-annex-shell.hs4
3 files changed, 10 insertions, 8 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 7f708f15a..fb2792cf4 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -67,8 +67,8 @@ usage header cmds options = usageInfo top options ++ commands
showcmd c =
cmdname c ++
pad (longest cmdname + 1) (cmdname c) ++
- cmdparams c ++
- pad (longest cmdparams + 2) (cmdparams c) ++
+ cmdparamdesc c ++
+ pad (longest cmdparamdesc + 2) (cmdparamdesc c) ++
cmddesc c
pad n s = replicate (n - length s) ' '
longest f = foldl max 0 $ map (length . f) cmds
diff --git a/Types/Command.hs b/Types/Command.hs
index 5341a4054..3cabf7318 100644
--- a/Types/Command.hs
+++ b/Types/Command.hs
@@ -33,12 +33,12 @@ type CommandCleanup = Annex Bool
{- A command is defined by specifying these things. -}
data Command = Command {
- cmdnorepo :: Maybe (IO ()),
- cmdcheck :: [CommandCheck],
+ cmdnorepo :: Maybe (IO ()), -- an action to run when not in a repo
+ cmdcheck :: [CommandCheck], -- check stage
cmdname :: String,
- cmdparams :: String,
- cmdseek :: [CommandSeek],
- cmddesc :: String
+ cmdparamdesc :: String, -- description of params for usage
+ cmdseek :: [CommandSeek], -- seek stage
+ cmddesc :: String -- description of command for usage
}
{- CommandCheck functions can be compared using their unique id. -}
diff --git a/git-annex-shell.hs b/git-annex-shell.hs
index 872dabc58..1ff0bba44 100644
--- a/git-annex-shell.hs
+++ b/git-annex-shell.hs
@@ -36,7 +36,9 @@ cmds_notreadonly = concat
cmds :: [Command]
cmds = map adddirparam $ cmds_readonly ++ cmds_notreadonly
where
- adddirparam c = c { cmdparams = "DIRECTORY " ++ cmdparams c }
+ adddirparam c = c
+ { cmdparamdesc = "DIRECTORY " ++ cmdparamdesc c
+ }
options :: [OptDescr (Annex ())]
options = commonOptions ++