summaryrefslogtreecommitdiff
path: root/Command
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
parentafbce3349b3bd7a97377839892da4118b909068f (diff)
add, import: Support --json output.
Include added key in output.
Diffstat (limited to 'Command')
-rw-r--r--Command/Add.hs4
-rw-r--r--Command/Import.hs2
2 files changed, 4 insertions, 2 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
diff --git a/Command/Import.hs b/Command/Import.hs
index 7e8ce3b7a..4e9ff69dc 100644
--- a/Command/Import.hs
+++ b/Command/Import.hs
@@ -23,7 +23,7 @@ import Types.FileMatcher
import Annex.FileMatcher
cmd :: Command
-cmd = withGlobalOptions (jobsOption : fileMatchingOptions) $ notBareRepo $
+cmd = withGlobalOptions (jobsOption : jsonOption : fileMatchingOptions) $ notBareRepo $
command "import" SectionCommon
"move and add files from outside git working copy"
paramPaths (seek <$$> optParser)