Remove key:null from git-annex add --json output.
This commit is contained in:
parent
4a09b4bbbd
commit
f421a7f001
2 changed files with 8 additions and 4 deletions
|
@ -6,6 +6,7 @@ git-annex (6.20160908) UNRELEASED; urgency=medium
|
||||||
over ssh etc.
|
over ssh etc.
|
||||||
* Make --json and --quiet work when used with -J.
|
* Make --json and --quiet work when used with -J.
|
||||||
Previously, -J override the other options.
|
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
|
-- Joey Hess <id@joeyh.name> Thu, 08 Sep 2016 12:48:55 -0400
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import qualified Data.Map as M
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.ByteString.Lazy as B
|
import qualified Data.ByteString.Lazy as B
|
||||||
import System.IO
|
import System.IO
|
||||||
|
import Data.Maybe
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import Prelude
|
import Prelude
|
||||||
|
|
||||||
|
@ -84,10 +85,12 @@ data JSONActionItem a = JSONActionItem
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
instance ToJSON (JSONActionItem a) where
|
instance ToJSON (JSONActionItem a) where
|
||||||
toJSON i = object
|
toJSON i = object $ catMaybes
|
||||||
[ "command" .= itemCommand i
|
[ Just $ "command" .= itemCommand i
|
||||||
, "key" .= (toJSON (itemKey i))
|
, case itemKey i of
|
||||||
, "file" .= itemFile i
|
Nothing -> Nothing
|
||||||
|
Just k -> Just $ "key" .= toJSON k
|
||||||
|
, Just $ "file" .= itemFile i
|
||||||
-- itemAdded is not included; must be added later by 'add'
|
-- itemAdded is not included; must be added later by 'add'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue