summaryrefslogtreecommitdiff
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-03-27 13:51:24 -0400
committerJoey Hess <joey@kitenet.net>2013-03-27 13:51:24 -0400
commit50e2ea38256f2992abe43beb3c7e8a7984559ecb (patch)
treee9341307e74e38594c6a8420299281829fe2516b /CmdLine.hs
parent99d3c3cec3dcfe88a987180702028df981b3cb84 (diff)
Per-command usage messages.
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 4899354536..db46cba823 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -48,7 +48,7 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do
err msg = msg ++ "\n\n" ++ usage header allcmds
cmd = Prelude.head cmds
(fuzzy, cmds, name, args) = findCmd fuzzyok allargs allcmds err
- (flags, params) = getOptCmd args cmd commonoptions err
+ (flags, params) = getOptCmd args cmd commonoptions
checkfuzzy = when fuzzy $
inRepo $ Git.AutoCorrect.prepare name cmdname cmds
@@ -74,12 +74,15 @@ findCmd fuzzyok argv cmds err
{- Parses command line options, and returns actions to run to configure flags
- and the remaining parameters for the command. -}
-getOptCmd :: Params -> Command -> [Option] -> (String -> String) -> (Flags, Params)
-getOptCmd argv cmd commonoptions err = check $
+getOptCmd :: Params -> Command -> [Option] -> (Flags, Params)
+getOptCmd argv cmd commonoptions = check $
getOpt Permute (commonoptions ++ cmdoptions cmd) argv
where
check (flags, rest, []) = (flags, rest)
- check (_, _, errs) = error $ err $ concat errs
+ check (_, _, errs) = error $ unlines
+ [ concat errs
+ , commandUsage cmd
+ ]
{- Runs a list of Annex actions. Catches IO errors and continues
- (but explicitly thrown errors terminate the whole command).