summaryrefslogtreecommitdiff
path: root/Command/Help.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-27 13:51:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-27 13:51:24 -0400
commitd010ee969c82d6bb2d0f60c4b1ce2de3543e0920 (patch)
treefef62e7155b8ae9977ce51294339693f548cd964 /Command/Help.hs
parent3b1d7915569b0dbfa6cefc54e0537d19290e08bf (diff)
Per-command usage messages.
Diffstat (limited to 'Command/Help.hs')
-rw-r--r--Command/Help.hs19
1 files changed, 14 insertions, 5 deletions
diff --git a/Command/Help.hs b/Command/Help.hs
index 9f7bb34ae..576298226 100644
--- a/Command/Help.hs
+++ b/Command/Help.hs
@@ -18,21 +18,30 @@ import qualified Command.Copy
import qualified Command.Sync
import qualified Command.Whereis
import qualified Command.Fsck
+import GitAnnex.Options
+
+import System.Console.GetOpt
def :: [Command]
-def = [noCommit $ noRepo showHelp $ dontCheck repoExists $
+def = [noCommit $ noRepo showGeneralHelp $ dontCheck repoExists $
command "help" paramNothing seek SectionUtility "display help"]
seek :: [CommandSeek]
seek = [withWords start]
start :: [String] -> CommandStart
+start ["options"] = do
+ liftIO showCommonOptions
+ stop
start _ = do
- liftIO showHelp
+ liftIO showGeneralHelp
stop
-showHelp :: IO ()
-showHelp = liftIO $ putStrLn $ unlines
+showCommonOptions :: IO ()
+showCommonOptions = putStrLn $ usageInfo "Common options:" options
+
+showGeneralHelp :: IO ()
+showGeneralHelp = putStrLn $ unlines
[ "The most commonly used git-annex commands are:"
, unlines $ map cmdline $ concat
[ Command.Init.def
@@ -45,7 +54,7 @@ showHelp = liftIO $ putStrLn $ unlines
, Command.Whereis.def
, Command.Fsck.def
]
- , "Run git-annex without any options for a complete command and option list."
+ , "Run git-annex without any options for a complete command list."
]
where
cmdline c = "\t" ++ cmdname c ++ "\t" ++ cmddesc c