diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-02-16 13:24:16 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-02-16 13:24:35 -0400 |
commit | 34bcff4cba4a8f866110309ae00bcd4a8deb7551 (patch) | |
tree | a187a962bb859d8a77ef59c459e5cc2ace0dd795 /Command | |
parent | b65b8fe7f1b63403e8b1fd1e149e0adb5b00277d (diff) |
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.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Config.hs | 5 | ||||
-rw-r--r-- | Command/Group.hs | 5 | ||||
-rw-r--r-- | Command/GroupWanted.hs | 3 | ||||
-rw-r--r-- | Command/NumCopies.hs | 5 | ||||
-rw-r--r-- | Command/Schedule.hs | 6 | ||||
-rw-r--r-- | Command/Wanted.hs | 7 |
6 files changed, 16 insertions, 15 deletions
diff --git a/Command/Config.hs b/Command/Config.hs index 690c8d288..c9b6a7b0b 100644 --- a/Command/Config.hs +++ b/Command/Config.hs @@ -11,7 +11,8 @@ import Command import Logs.Config cmd :: Command -cmd = command "config" SectionSetup "configuration stored in git-annex branch" +cmd = noMessages $ command "config" SectionSetup + "configuration stored in git-annex branch" paramNothing (seek <$$> optParser) data Action @@ -47,11 +48,13 @@ optParser _ = setconfig <|> getconfig <|> unsetconfig seek :: Action -> CommandSeek seek (SetConfig name val) = commandAction $ do + allowMessages showStart name val next $ next $ do setGlobalConfig name val return True seek (UnsetConfig name) = commandAction $ do + allowMessages showStart name "unset" next $ next $ do unsetGlobalConfig name diff --git a/Command/Group.hs b/Command/Group.hs index 6d9b4ab13..65e062589 100644 --- a/Command/Group.hs +++ b/Command/Group.hs @@ -15,7 +15,7 @@ import Types.Group import qualified Data.Set as S cmd :: Command -cmd = command "group" SectionSetup "add a repository to a group" +cmd = noMessages $ command "group" SectionSetup "add a repository to a group" (paramPair paramRemote paramDesc) (withParams seek) seek :: CmdParams -> CommandSeek @@ -23,12 +23,13 @@ seek = withWords start start :: [String] -> CommandStart start (name:g:[]) = do + allowMessages showStart "group" name u <- Remote.nameToUUID name next $ setGroup u g start (name:[]) = do u <- Remote.nameToUUID name - showRaw . unwords . S.toList =<< lookupGroups u + liftIO . putStrLn . unwords . S.toList =<< lookupGroups u stop start _ = giveup "Specify a repository and a group." diff --git a/Command/GroupWanted.hs b/Command/GroupWanted.hs index c0be2462d..939b3030a 100644 --- a/Command/GroupWanted.hs +++ b/Command/GroupWanted.hs @@ -12,7 +12,7 @@ import Logs.PreferredContent import Command.Wanted (performGet, performSet) cmd :: Command -cmd = command "groupwanted" SectionSetup +cmd = noMessages $ command "groupwanted" SectionSetup "get or set groupwanted expression" (paramPair paramGroup (paramOptional paramExpression)) (withParams seek) @@ -23,6 +23,7 @@ seek = withWords start start :: [String] -> CommandStart start (g:[]) = next $ performGet groupPreferredContentMapRaw g start (g:expr:[]) = do + allowMessages showStart "groupwanted" g next $ performSet groupPreferredContentSet expr g start _ = giveup "Specify a group." diff --git a/Command/NumCopies.hs b/Command/NumCopies.hs index 005a0d16a..9e467da7a 100644 --- a/Command/NumCopies.hs +++ b/Command/NumCopies.hs @@ -10,10 +10,9 @@ module Command.NumCopies where import Command import qualified Annex import Annex.NumCopies -import Types.Messages cmd :: Command -cmd = command "numcopies" SectionSetup +cmd = noMessages $ command "numcopies" SectionSetup "configure desired number of copies" paramNumber (withParams seek) @@ -35,7 +34,6 @@ start _ = giveup "Specify a single number." startGet :: CommandStart startGet = next $ next $ do - Annex.setOutput QuietOutput v <- getGlobalNumCopies case v of Just n -> liftIO $ putStrLn $ show $ fromNumCopies n @@ -49,6 +47,7 @@ startGet = next $ next $ do startSet :: Int -> CommandStart startSet n = do + allowMessages showStart "numcopies" (show n) next $ next $ do setGlobalNumCopies $ NumCopies n diff --git a/Command/Schedule.hs b/Command/Schedule.hs index c9d4f915f..5814d99f1 100644 --- a/Command/Schedule.hs +++ b/Command/Schedule.hs @@ -8,16 +8,14 @@ module Command.Schedule where import Command -import qualified Annex import qualified Remote import Logs.Schedule import Types.ScheduledActivity -import Types.Messages import qualified Data.Set as S cmd :: Command -cmd = command "schedule" SectionSetup "get or set scheduled jobs" +cmd = noMessages $ command "schedule" SectionSetup "get or set scheduled jobs" (paramPair paramRemote (paramOptional paramExpression)) (withParams seek) @@ -29,6 +27,7 @@ start = parse where parse (name:[]) = go name performGet parse (name:expr:[]) = go name $ \uuid -> do + allowMessages showStart "schedule" name performSet expr uuid parse _ = giveup "Specify a repository." @@ -39,7 +38,6 @@ start = parse performGet :: UUID -> CommandPerform performGet uuid = do - Annex.setOutput QuietOutput s <- scheduleGet uuid liftIO $ putStrLn $ intercalate "; " $ map fromScheduledActivity $ S.toList s diff --git a/Command/Wanted.hs b/Command/Wanted.hs index 8fd369df6..fc1fa86bd 100644 --- a/Command/Wanted.hs +++ b/Command/Wanted.hs @@ -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 |