summaryrefslogtreecommitdiff
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
parent770ce7bf2a1fdc32d876deebfd23ddb90ad7c20b (diff)
Man pages for individual commands now available, and can be opened using "git annex help <command>"
-rw-r--r--Command/Help.hs14
-rw-r--r--debian/changelog2
-rw-r--r--doc/git-annex.mdwn6
3 files changed, 20 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 ++ "/"
diff --git a/debian/changelog b/debian/changelog
index fe164a81a..18d7b22b6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ git-annex (5.20150318) UNRELEASED; urgency=medium
is updated. Needed for git update-server-info.
* migrate: --force will force migration of keys already using the
destination backend. Useful in rare cases.
+ * Man pages for individual commands now available, and can be
+ opened using "git annex help <command>"
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index b6f8022ff..53e981f1c 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -60,6 +60,12 @@ files in the directory. When no path is specified, most git-annex commands
default to acting on all relevant files in the current directory (and
subdirectories).
+* `help`
+
+ Display built-in help.
+
+ For help on a specific command, use `git annex help command`
+
* `add [path ...]`
Adds files in the path to the annex. If no path is specified, adds