2012-10-13 23:07:56 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
|
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Help where
|
|
|
|
|
|
|
|
import Common.Annex
|
|
|
|
import Command
|
|
|
|
import qualified Command.Init
|
|
|
|
import qualified Command.Add
|
|
|
|
import qualified Command.Drop
|
|
|
|
import qualified Command.Get
|
|
|
|
import qualified Command.Move
|
|
|
|
import qualified Command.Copy
|
|
|
|
import qualified Command.Sync
|
|
|
|
import qualified Command.Whereis
|
|
|
|
import qualified Command.Fsck
|
2013-03-27 17:51:24 +00:00
|
|
|
import GitAnnex.Options
|
|
|
|
|
|
|
|
import System.Console.GetOpt
|
2012-10-13 23:07:56 +00:00
|
|
|
|
|
|
|
def :: [Command]
|
2013-03-27 17:51:24 +00:00
|
|
|
def = [noCommit $ noRepo showGeneralHelp $ dontCheck repoExists $
|
2013-04-21 00:24:57 +00:00
|
|
|
command "help" paramNothing seek SectionQuery "display help"]
|
2012-10-13 23:07:56 +00:00
|
|
|
|
|
|
|
seek :: [CommandSeek]
|
|
|
|
seek = [withWords start]
|
|
|
|
|
|
|
|
start :: [String] -> CommandStart
|
2013-03-27 17:51:24 +00:00
|
|
|
start ["options"] = do
|
|
|
|
liftIO showCommonOptions
|
|
|
|
stop
|
2012-10-13 23:07:56 +00:00
|
|
|
start _ = do
|
2013-03-27 17:51:24 +00:00
|
|
|
liftIO showGeneralHelp
|
2012-10-13 23:07:56 +00:00
|
|
|
stop
|
|
|
|
|
2013-03-27 17:51:24 +00:00
|
|
|
showCommonOptions :: IO ()
|
|
|
|
showCommonOptions = putStrLn $ usageInfo "Common options:" options
|
|
|
|
|
|
|
|
showGeneralHelp :: IO ()
|
|
|
|
showGeneralHelp = putStrLn $ unlines
|
2013-04-21 00:23:11 +00:00
|
|
|
[ "The most frequently used git-annex commands are:"
|
2012-10-13 23:07:56 +00:00
|
|
|
, unlines $ map cmdline $ concat
|
|
|
|
[ Command.Init.def
|
|
|
|
, Command.Add.def
|
|
|
|
, Command.Drop.def
|
|
|
|
, Command.Get.def
|
|
|
|
, Command.Move.def
|
|
|
|
, Command.Copy.def
|
|
|
|
, Command.Sync.def
|
|
|
|
, Command.Whereis.def
|
|
|
|
, Command.Fsck.def
|
|
|
|
]
|
2013-04-21 00:23:11 +00:00
|
|
|
, "Run 'git-annex' for a complete command list."
|
|
|
|
, "Run 'git-annex command --help' for help on a specific command."
|
|
|
|
, "Run `git annex help options' for a list of common options."
|
2012-10-13 23:07:56 +00:00
|
|
|
]
|
2012-11-12 05:05:04 +00:00
|
|
|
where
|
|
|
|
cmdline c = "\t" ++ cmdname c ++ "\t" ++ cmddesc c
|