add, import: Support --json output.
Include added key in output.
This commit is contained in:
parent
aae77b1856
commit
7b8e79c0f0
5 changed files with 15 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -6,6 +6,7 @@ git-annex (6.20160115) UNRELEASED; urgency=medium
|
|||
* Force output to be line-buffered, even when it's not connected to the
|
||||
terminal. This is particuarly important for commands with --batch
|
||||
output, which was not always being flushed at an appropriate time.
|
||||
* add, import: Support --json output.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Fri, 15 Jan 2016 14:05:01 -0400
|
||||
|
||||
|
|
|
@ -54,6 +54,11 @@ annexed content, and other symlinks.
|
|||
Adds multiple files in parallel. This may be faster.
|
||||
For example: `-J4`
|
||||
|
||||
* `--json`
|
||||
|
||||
Enable JSON output. This is intended to be parsed by programs that use
|
||||
git-annex. Each line of output is a JSON object.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
[[git-annex]](1)
|
||||
|
|
|
@ -71,6 +71,11 @@ Several options can be used to adjust handling of duplicate files.
|
|||
Imports multiple files in parallel. This may be faster.
|
||||
For example: `-J4`
|
||||
|
||||
* `--json`
|
||||
|
||||
Enable JSON output. This is intended to be parsed by programs that use
|
||||
git-annex. Each line of output is a JSON object.
|
||||
|
||||
# CAVEATS
|
||||
|
||||
Note that using `--deduplicate` or `--clean-duplicates` with the WORM
|
||||
|
|
Loading…
Reference in a new issue