diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-09 14:26:34 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-09 14:26:34 -0400 |
commit | 8f8a17cf1855d809bf3655a3e4e9351b3850d3f2 (patch) | |
tree | e11ee7715e551211f0e0788b3aad268fa9e17e0b /Messages | |
parent | 254479fb1b6cb1906729cda1f9fac76ddbeec4e5 (diff) |
Remove key:null from git-annex add --json output.
Diffstat (limited to 'Messages')
-rw-r--r-- | Messages/JSON.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Messages/JSON.hs b/Messages/JSON.hs index 9f8f31c46..0cceda3f3 100644 --- a/Messages/JSON.hs +++ b/Messages/JSON.hs @@ -24,6 +24,7 @@ import qualified Data.Map as M import qualified Data.Text as T import qualified Data.ByteString.Lazy as B import System.IO +import Data.Maybe import Data.Monoid import Prelude @@ -84,10 +85,12 @@ data JSONActionItem a = JSONActionItem 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' ] |