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:
parent
baa2ab2c7d
commit
d0651bb567
10 changed files with 51 additions and 15 deletions
12
Command.hs
12
Command.hs
|
@ -22,12 +22,14 @@ import CmdLine.GlobalSetter as ReExported
|
|||
import CmdLine.GitAnnex.Options as ReExported
|
||||
import CmdLine.Batch as ReExported
|
||||
import Options.Applicative as ReExported hiding (command)
|
||||
import qualified Annex
|
||||
import qualified Git
|
||||
import Annex.Init
|
||||
import Config
|
||||
import Utility.Daemon
|
||||
import Types.Transfer
|
||||
import Types.ActionItem
|
||||
import Types.Messages
|
||||
|
||||
{- Generates a normal Command -}
|
||||
command :: String -> CommandSection -> String -> CmdParamsDesc -> (CmdParamsDesc -> CommandParser) -> Command
|
||||
|
@ -63,6 +65,16 @@ noCommit c = c { cmdnocommit = True }
|
|||
noMessages :: Command -> Command
|
||||
noMessages c = c { cmdnomessages = True }
|
||||
|
||||
{- Undoes noMessages -}
|
||||
allowMessages :: Annex ()
|
||||
allowMessages = do
|
||||
curr <- Annex.getState Annex.output
|
||||
case outputType curr of
|
||||
QuietOutput -> Annex.setOutput NormalOutput
|
||||
_ -> noop
|
||||
Annex.changeState $ \s -> s
|
||||
{ Annex.output = (Annex.output s) { implicitMessages = True } }
|
||||
|
||||
{- Adds a fallback action to a command, that will be run if it's used
|
||||
- outside a git repository. -}
|
||||
noRepo :: (String -> Parser (IO ())) -> Command -> Command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue