make query commands not output extraneous messages

config group groupwanted numcopies schedule wanted required:  Avoid
displaying extraneous messages about repository auto-init, git-annex branch
merging, etc, when being used to get information.
This commit is contained in:
Joey Hess 2017-02-16 13:24:16 -04:00
parent baa2ab2c7d
commit d0651bb567
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
10 changed files with 51 additions and 15 deletions

View file

@ -8,10 +8,8 @@
module Command.Wanted where
import Command
import qualified Annex
import qualified Remote
import Logs.PreferredContent
import Types.Messages
import Types.StandardGroups
import qualified Data.Map as M
@ -27,7 +25,8 @@ cmd'
-> Annex (M.Map UUID PreferredContentExpression)
-> (UUID -> PreferredContentExpression -> Annex ())
-> Command
cmd' name desc getter setter = command name SectionSetup desc pdesc (withParams seek)
cmd' name desc getter setter = noMessages $
command name SectionSetup desc pdesc (withParams seek)
where
pdesc = paramPair paramRemote (paramOptional paramExpression)
@ -35,6 +34,7 @@ cmd' name desc getter setter = command name SectionSetup desc pdesc (withParams
start (rname:[]) = go rname (performGet getter)
start (rname:expr:[]) = go rname $ \uuid -> do
allowMessages
showStart name rname
performSet setter expr uuid
start _ = giveup "Specify a repository."
@ -45,7 +45,6 @@ cmd' name desc getter setter = command name SectionSetup desc pdesc (withParams
performGet :: Ord a => Annex (M.Map a PreferredContentExpression) -> a -> CommandPerform
performGet getter a = do
Annex.setOutput QuietOutput
m <- getter
liftIO $ putStrLn $ fromMaybe "" $ M.lookup a m
next $ return True