eliminate showStart showStartOther

These were not handling control characters and are redundant.

Sponsored-by: Jack Hill on Patreon
This commit is contained in:
Joey Hess 2023-04-10 16:07:54 -04:00
parent 3290a09a70
commit a0e6fa18eb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 22 additions and 39 deletions

View file

@ -8,8 +8,6 @@
{-# LANGUAGE OverloadedStrings #-}
module Messages (
showStart,
showStartOther,
showStartMessage,
showEndMessage,
StartMessage(..),
@ -70,32 +68,6 @@ import Annex.Concurrent.Utility
import qualified Messages.JSON as JSON
import qualified Annex
showStart :: String -> RawFilePath -> SeekInput -> Annex ()
showStart command file si = outputMessage json $
encodeBS command <> " " <> file <> " "
where
json = JSON.start command (Just file) Nothing si
showStartActionItem :: String -> ActionItem -> SeekInput -> Annex ()
showStartActionItem command ai si = do
qp <- coreQuotePath <$> Annex.getGitConfig
outputMessage json $
encodeBS command <> " " <> actionItemDesc qp ai <> " "
where
json = JSON.start command (actionItemFile ai) (actionItemKey ai) si
showStartOther :: String -> Maybe String -> SeekInput -> Annex ()
showStartOther command mdesc si = outputMessage json $ encodeBS $
command ++ (maybe "" (" " ++) mdesc) ++ " "
where
json = JSON.start command Nothing Nothing si
showStartNothing :: String -> SeekInput -> Annex ()
showStartNothing command si = outputMessage json $ encodeBS $
command ++ " "
where
json = JSON.start command Nothing Nothing si
showStartMessage :: StartMessage -> Annex ()
showStartMessage (StartMessage command ai si) = case ai of
ActionItemAssociatedFile _ _ -> showStartActionItem command ai si
@ -117,6 +89,20 @@ showStartMessage (CustomOutput _) =
NormalOutput -> Annex.setOutput QuietOutput
_ -> noop
showStartActionItem :: String -> ActionItem -> SeekInput -> Annex ()
showStartActionItem command ai si = do
qp <- coreQuotePath <$> Annex.getGitConfig
outputMessage json $
encodeBS command <> " " <> actionItemDesc qp ai <> " "
where
json = JSON.start command (actionItemFile ai) (actionItemKey ai) si
showStartNothing :: String -> SeekInput -> Annex ()
showStartNothing command si = outputMessage json $ encodeBS $
command ++ " "
where
json = JSON.start command Nothing Nothing si
-- Only show end result if the StartMessage is one that gets displayed.
showEndMessage :: StartMessage -> Bool -> Annex ()
showEndMessage (StartMessage _ _ _) = showEndResult