From dc1c08d474518234642ce78935d8835ff847cf35 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 30 Oct 2017 14:44:11 -0400 Subject: unlock, lock: Support --json. --- CHANGELOG | 1 + Command/Lock.hs | 2 +- Command/Unlock.hs | 2 +- doc/git-annex-lock.mdwn | 5 +++++ doc/git-annex-unlock.mdwn | 5 +++++ doc/todo/unlock_--json.mdwn | 2 ++ .../comment_2_f00fda45d300ce14a5ea6fd32a20defe._comment | 12 ++++++++++++ 7 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 doc/todo/unlock_--json/comment_2_f00fda45d300ce14a5ea6fd32a20defe._comment diff --git a/CHANGELOG b/CHANGELOG index 929b8f98d..06480e1ec 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 Mon, 30 Oct 2017 12:01:45 -0400 diff --git a/Command/Lock.hs b/Command/Lock.hs index 90d293799..e3e3e0fe7 100644 --- a/Command/Lock.hs +++ b/Command/Lock.hs @@ -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) diff --git a/Command/Unlock.hs b/Command/Unlock.hs index 274f4af3c..44e3f1bf3 100644 --- a/Command/Unlock.hs +++ b/Command/Unlock.hs @@ -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 diff --git a/doc/git-annex-lock.mdwn b/doc/git-annex-lock.mdwn index b9e5d3450..cf4910b95 100644 --- a/doc/git-annex-lock.mdwn +++ b/doc/git-annex-lock.mdwn @@ -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) diff --git a/doc/git-annex-unlock.mdwn b/doc/git-annex-unlock.mdwn index 8a41015c3..28defa4f7 100644 --- a/doc/git-annex-unlock.mdwn +++ b/doc/git-annex-unlock.mdwn @@ -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) diff --git a/doc/todo/unlock_--json.mdwn b/doc/todo/unlock_--json.mdwn index fb1da0fc1..694effff8 100644 --- a/doc/todo/unlock_--json.mdwn +++ b/doc/todo/unlock_--json.mdwn @@ -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]] diff --git a/doc/todo/unlock_--json/comment_2_f00fda45d300ce14a5ea6fd32a20defe._comment b/doc/todo/unlock_--json/comment_2_f00fda45d300ce14a5ea6fd32a20defe._comment new file mode 100644 index 000000000..294bbcfea --- /dev/null +++ b/doc/todo/unlock_--json/comment_2_f00fda45d300ce14a5ea6fd32a20defe._comment @@ -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. +""]] -- cgit v1.2.3