summaryrefslogtreecommitdiff
path: root/Command/Help.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-03-23 17:35:39 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-03-23 17:50:03 -0400
commit277b7335378e41d1a0ecb5fdc93760435b05fc5d (patch)
treec3a707a9e30fb050b155277616189572038854fb /Command/Help.hs
parent770ce7bf2a1fdc32d876deebfd23ddb90ad7c20b (diff)
Man pages for individual commands now available, and can be opened using "git annex help <command>"
Diffstat (limited to 'Command/Help.hs')
-rw-r--r--Command/Help.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/Command/Help.hs b/Command/Help.hs
index 72913d7c4..2af39ac9a 100644
--- a/Command/Help.hs
+++ b/Command/Help.hs
@@ -23,7 +23,7 @@ import System.Console.GetOpt
cmd :: [Command]
cmd = [noCommit $ noRepo startNoRepo $ dontCheck repoExists $
- command "help" paramNothing seek SectionQuery "display help"]
+ command "help" (paramOptional "COMMAND") seek SectionCommon "display help"]
seek :: CommandSeek
seek = withWords start
@@ -38,6 +38,7 @@ startNoRepo = start'
start' :: [String] -> IO ()
start' ["options"] = showCommonOptions
+start' [c] = showGitHelp c
start' _ = showGeneralHelp
showCommonOptions :: IO ()
@@ -58,8 +59,17 @@ showGeneralHelp = putStrLn $ unlines
, Command.Fsck.cmd
]
, "Run 'git-annex' for a complete command list."
- , "Run 'git-annex command --help' for help on a specific command."
+ , "Run 'git-annex help command' for help on a specific command."
, "Run `git annex help options' for a list of common options."
]
where
cmdline c = "\t" ++ cmdname c ++ "\t" ++ cmddesc c
+
+showGitHelp :: String -> IO ()
+showGitHelp c =
+ unlessM (githelp) $
+ putStrLn $ "View online help at " ++ url
+ where
+ githelp = boolSystem "git" [Param "help", Param fullc]
+ fullc = "git-annex-" ++ c
+ url = "https://git-annex.branchable.com/" ++ fullc ++ "/"