add, import: Support --json output.

Include added key in output.
This commit is contained in:
Joey Hess 2016-01-19 11:54:13 -04:00
parent aae77b1856
commit 7b8e79c0f0
Failed to extract signature
5 changed files with 15 additions and 2 deletions

View file

@ -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