over ssh etc.
* Make --json and --quiet work when used with -J.
Previously, -J override the other options.
+ * Remove key:null from git-annex add --json output.
-- Joey Hess <id@joeyh.name> Thu, 08 Sep 2016 12:48:55 -0400
import qualified Data.Text as T
import qualified Data.ByteString.Lazy as B
import System.IO
+import Data.Maybe
import Data.Monoid
import Prelude
deriving (Show)
instance ToJSON (JSONActionItem a) where
- toJSON i = object
- [ "command" .= itemCommand i
- , "key" .= (toJSON (itemKey i))
- , "file" .= itemFile i
+ toJSON i = object $ catMaybes
+ [ Just $ "command" .= itemCommand i
+ , case itemKey i of
+ Nothing -> Nothing
+ Just k -> Just $ "key" .= toJSON k
+ , Just $ "file" .= itemFile i
-- itemAdded is not included; must be added later by 'add'
]