make "git annex help options" work outside a git repo

Option parsing for commands that run outside git repos is still screwy,
as there is no Annex monad and so the flags cannot be passed in. But,
any remaining parameters can be, which is enough for this fix.
This commit is contained in:
Joey Hess 2013-11-30 15:18:40 -04:00
parent 6edac746f0
commit fa3045aa8b
9 changed files with 31 additions and 24 deletions

View file

@ -23,20 +23,24 @@ import GitAnnex.Options
import System.Console.GetOpt
def :: [Command]
def = [noCommit $ noRepo showGeneralHelp $ dontCheck repoExists $
def = [noCommit $ noRepo startNoRepo $ dontCheck repoExists $
command "help" paramNothing seek SectionQuery "display help"]
seek :: [CommandSeek]
seek = [withWords start]
start :: [String] -> CommandStart
start ["options"] = do
liftIO showCommonOptions
stop
start _ = do
liftIO showGeneralHelp
start params = do
liftIO $ start' params
stop
startNoRepo :: CmdParams -> IO ()
startNoRepo = start'
start' :: [String] -> IO ()
start' ["options"] = showCommonOptions
start' _ = showGeneralHelp
showCommonOptions :: IO ()
showCommonOptions = putStrLn $ usageInfo "Common options:" options