diff options
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Assistant.hs | 4 | ||||
-rw-r--r-- | Command/Help.hs | 16 | ||||
-rw-r--r-- | Command/Upgrade.hs | 2 | ||||
-rw-r--r-- | Command/Version.hs | 5 | ||||
-rw-r--r-- | Command/WebApp.hs | 6 | ||||
-rw-r--r-- | Command/XMPPGit.hs | 5 |
6 files changed, 23 insertions, 15 deletions
diff --git a/Command/Assistant.hs b/Command/Assistant.hs index 521a88571..cef4392dc 100644 --- a/Command/Assistant.hs +++ b/Command/Assistant.hs @@ -55,8 +55,8 @@ start foreground stopdaemon autostart startdelay {- Run outside a git repository. Check to see if any parameter is - --autostart and enter autostart mode. -} -checkAutoStart :: IO () -checkAutoStart = ifM (elem "--autostart" <$> getArgs) +checkAutoStart :: CmdParams -> IO () +checkAutoStart _ = ifM (elem "--autostart" <$> getArgs) ( autoStart Nothing , error "Not in a git repository." ) diff --git a/Command/Help.hs b/Command/Help.hs index c77f739c1..71e767663 100644 --- a/Command/Help.hs +++ b/Command/Help.hs @@ -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 diff --git a/Command/Upgrade.hs b/Command/Upgrade.hs index c6c0f7a8c..de34278dd 100644 --- a/Command/Upgrade.hs +++ b/Command/Upgrade.hs @@ -10,8 +10,6 @@ module Command.Upgrade where import Common.Annex import Command import Upgrade -import Annex.Version -import Config def :: [Command] def = [dontCheck repoExists $ -- because an old version may not seem to exist diff --git a/Command/Version.hs b/Command/Version.hs index b330d1ff1..13b839e66 100644 --- a/Command/Version.hs +++ b/Command/Version.hs @@ -18,7 +18,7 @@ import qualified Remote import qualified Backend def :: [Command] -def = [noCommit $ noRepo showPackageVersion $ dontCheck repoExists $ +def = [noCommit $ noRepo startNoRepo $ dontCheck repoExists $ command "version" paramNothing seek SectionQuery "show version info"] seek :: [CommandSeek] @@ -37,6 +37,9 @@ start = do unwords upgradableVersions stop +startNoRepo :: CmdParams -> IO () +startNoRepo _ = showPackageVersion + showPackageVersion :: IO () showPackageVersion = do info "git-annex version" SysConfig.packageversion diff --git a/Command/WebApp.hs b/Command/WebApp.hs index 70f28a113..a009be15d 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -82,7 +82,7 @@ start' allowauto listenhost = do else openBrowser browser htmlshim url origout origerr ) auto - | allowauto = liftIO startNoRepo + | allowauto = liftIO $ startNoRepo [] | otherwise = do d <- liftIO getCurrentDirectory error $ "no git repository in " ++ d @@ -93,8 +93,8 @@ start' allowauto listenhost = do {- When run without a repo, start the first available listed repository in - the autostart file. If not, it's our first time being run! -} -startNoRepo :: IO () -startNoRepo = do +startNoRepo :: CmdParams -> IO () +startNoRepo _ = do -- FIXME should be able to reuse regular getopt, but -- it currently runs in the Annex monad. args <- getArgs diff --git a/Command/XMPPGit.hs b/Command/XMPPGit.hs index c1ff0b108..796e8b4ed 100644 --- a/Command/XMPPGit.hs +++ b/Command/XMPPGit.hs @@ -12,7 +12,7 @@ import Command import Assistant.XMPP.Git def :: [Command] -def = [noCommit $ noRepo xmppGitRelay $ dontCheck repoExists $ +def = [noCommit $ noRepo startNoRepo $ dontCheck repoExists $ command "xmppgit" paramNothing seek SectionPlumbing "git to XMPP relay"] @@ -25,6 +25,9 @@ start _ = do liftIO xmppGitRelay stop +startNoRepo :: CmdParams -> IO () +startNoRepo _ = xmppGitRelay + {- A basic implementation of the git-remote-helpers protocol. -} gitRemoteHelper :: IO () gitRemoteHelper = do |