summaryrefslogtreecommitdiff
path: root/Command/Add.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-19 11:54:13 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-19 11:56:38 -0400
commit12b375f583773fc33f9f379d13622cd1892860a4 (patch)
tree15f2cfbc5c9b8b6a4b97503f493cc46f1e46c64e /Command/Add.hs
parentafbce3349b3bd7a97377839892da4118b909068f (diff)
add, import: Support --json output.
Include added key in output.
Diffstat (limited to 'Command/Add.hs')
-rw-r--r--Command/Add.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index b88dc52f7..0dea0a7b7 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -21,9 +21,10 @@ import Utility.InodeCache
import Annex.FileMatcher
import Annex.Version
import qualified Database.Keys
+import Types.Key
cmd :: Command
-cmd = notBareRepo $ withGlobalOptions (jobsOption : fileMatchingOptions) $
+cmd = notBareRepo $ withGlobalOptions (jobsOption : jsonOption : fileMatchingOptions) $
command "add" SectionCommon "add files to annex"
paramPaths (seek <$$> optParser)
@@ -126,6 +127,7 @@ perform file = do
cleanup :: FilePath -> Key -> Maybe InodeCache -> Bool -> CommandCleanup
cleanup file key mcache hascontent = do
+ maybeShowJSON [("key", key2file key)]
ifM (isDirect <&&> pure hascontent)
( do
l <- calcRepo $ gitAnnexLink file key