--json: multi-line notes
--json: When there are multiple lines of notes about a file, make the note field multiline, rather than the old behavior of only including the last line. Using newlines in the note is perhaps not ideal, but upgrading it to an array in this case would be an annoying inconsistency to need to deal with. This commit was sponsored by Ole-Morten Duesund on Patreon.
This commit is contained in:
parent
b1234135c3
commit
7e454ee341
2 changed files with 8 additions and 1 deletions
|
@ -75,8 +75,12 @@ end b (Just (o, _)) = Just (HM.insert "success" (toJSON b) o, True)
|
|||
end _ Nothing = Nothing
|
||||
|
||||
note :: String -> JSONBuilder
|
||||
note s (Just (o, e)) = Just (HM.insert "note" (toJSON s) o, e)
|
||||
note _ Nothing = Nothing
|
||||
note s (Just (o, e)) = Just (HM.insertWith combinelines "note" (toJSON s) o, e)
|
||||
where
|
||||
combinelines (String new) (String old) =
|
||||
String (old <> T.pack "\n" <> new)
|
||||
combinelines new _old = new
|
||||
|
||||
info :: String -> JSONBuilder
|
||||
info s _ = Just (o, True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue