factor out maybeAddJSONField

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
Joey Hess 2023-05-08 16:03:34 -04:00
parent 3d8f93dc0a
commit a5d0c85ae1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 22 additions and 18 deletions

View file

@ -12,11 +12,10 @@ import Annex.MetaData
import Annex.VectorClock
import Logs.MetaData
import Annex.WorkTree
import Messages.JSON (JSONActionItem(..), AddJSONActionItemField(..))
import Types.Messages
import Utility.Aeson
import Utility.SafeOutput
import Limit
import Messages.JSON (JSONActionItem(..), eitherDecode)
import qualified Data.Set as S
import qualified Data.Map as M
@ -127,9 +126,7 @@ perform c o k = case getSet o of
cleanup :: Key -> CommandCleanup
cleanup k = do
m <- getCurrentMetaData k
case toJSON' (AddJSONActionItemField "fields" m) of
Object o -> maybeShowJSON $ AesonObject o
_ -> noop
maybeAddJSONField "fields" m
showLongNote $ UnquotedString $ unlines $ concatMap showmeta $
map unwrapmeta (fromMetaData m)
return True