From 699611cde5cda8b2f2d83a6d6ac9c1e575b74f51 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 28 Nov 2017 14:40:26 -0400 Subject: showStart variant for when there's no worktree file Clean up some uses of showStart with "" for the file, or in some cases, a non-filename description string. That would generate bad json, although none of the commands doing that supported --json. Using "" for the file resulted in output like "foo rest"; now the extra space is eliminated. This commit was sponsored by Fernando Jimenez on Patreon. --- Messages.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Messages.hs') diff --git a/Messages.hs b/Messages.hs index ff13b31ee..08a7bb719 100644 --- a/Messages.hs +++ b/Messages.hs @@ -7,9 +7,10 @@ module Messages ( showStart, + showStart', + showStartKey, ActionItem, mkActionItem, - showStart', showNote, showAction, showSideAction, @@ -66,8 +67,14 @@ showStart command file = outputMessage json $ where json = JSON.start command (Just file) Nothing -showStart' :: String -> Key -> ActionItem -> Annex () -showStart' command key i = outputMessage json $ +showStart' :: String -> Maybe String -> Annex () +showStart' command mdesc = outputMessage json $ + command ++ (maybe "" (" " ++) mdesc) ++ " " + where + json = JSON.start command Nothing Nothing + +showStartKey :: String -> Key -> ActionItem -> Annex () +showStartKey command key i = outputMessage json $ command ++ " " ++ actionItemDesc i key ++ " " where json = JSON.start command (actionItemWorkTreeFile i) (Just key) -- cgit v1.2.3