unlock, lock: Support --json.

This commit is contained in:
Joey Hess 2017-10-30 14:44:11 -04:00
parent 325c40afef
commit 75ec0227f8
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 27 additions and 2 deletions

View file

@ -2,6 +2,7 @@ git-annex (6.20171027) UNRELEASED; urgency=medium
* Fix export of subdir of a branch.
* Fix exporting of non-annexed files to external special remotes.
* unlock, lock: Support --json.
-- Joey Hess <id@joeyh.name> Mon, 30 Oct 2017 12:01:45 -0400

View file

@ -23,7 +23,7 @@ import Logs.Location
import Git.FilePath
cmd :: Command
cmd = notDirect $ withGlobalOptions annexedMatchingOptions $
cmd = notDirect $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
command "lock" SectionCommon
"undo unlock command"
paramPaths (withParams seek)

View file

@ -26,7 +26,7 @@ editcmd :: Command
editcmd = mkcmd "edit" "same as unlock"
mkcmd :: String -> String -> Command
mkcmd n d = notDirect $ withGlobalOptions annexedMatchingOptions $
mkcmd n d = notDirect $ withGlobalOptions (jsonOption : annexedMatchingOptions) $
command n SectionCommon d paramPaths (withParams seek)
seek :: CmdParams -> CommandSeek

View file

@ -18,6 +18,11 @@ the files any longer, or have made modifications you want to discard.
The [[git-annex-matching-options]](1)
can be used to specify files to lock.
* `--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)

View file

@ -37,6 +37,11 @@ file to be lost from the local repository. So, enable annex.thin with care.
The [[git-annex-matching-options]](1)
can be used to specify files to unlock.
* `--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)

View file

@ -5,3 +5,5 @@ Unlock is quite heavy in terms of I/O and thus waiting time, so we (in datalad)
2. could there be a --json mode of output (consistent with add --json etc)?
[[!meta author=yoh]]
> added --json option [[done]] --[[Joey]]

View file

@ -0,0 +1,12 @@
[[!comment format=mdwn
username="joey"
subject="""comment 2"""
date="2017-10-30T18:40:53Z"
content="""
Why was I talking about batch mode here before? --json of course makes
sense to support for unlock (and lock). Adding that now.
And, to find the files that `git annex unlock` would operate on, you
can simply use `git annex find`, because that does not list already
unlocked files, and only files with their content present can be unlocked.
""]]