git-annex/Remote/Helper/Messages.hs
Joey Hess 8b6c7bdbcc
filter out control characters in all other Messages
This does, as a side effect, make long notes in json output not
be indented. The indentation is only needed to offset them
underneath the display of the file they apply to, so that's ok.

Sponsored-by: Brock Spratlen on Patreon
2023-04-11 12:58:01 -04:00

32 lines
763 B
Haskell

{- git-annex remote messages
-
- Copyright 2013 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}
module Remote.Helper.Messages where
import Annex.Common
import qualified Git
import qualified Types.Remote as Remote
class Describable a where
describe :: a -> String
instance Describable Git.Repo where
describe = Git.repoDescribe
instance Describable (Remote.RemoteA a) where
describe = Remote.name
instance Describable String where
describe = id
cantCheck :: Describable a => a -> e
cantCheck v = giveup $ "unable to check " ++ describe v
showLocking :: Describable a => a -> Annex ()
showLocking v = showAction $ UnquotedString $ "locking " ++ describe v