From 39cf838d85d378833dd3837ebfd1be881099eb74 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 9 Sep 2016 16:24:26 -0400 Subject: copy, move, mirror: Support --json and --json-progress. --- CHANGELOG | 1 + Command/Copy.hs | 2 +- Command/Mirror.hs | 2 +- Command/Move.hs | 2 +- doc/git-annex-copy.mdwn | 9 +++++++++ doc/git-annex-mirror.mdwn | 9 +++++++++ doc/git-annex-move.mdwn | 9 +++++++++ ...nterface_to_the___34__progress__34___of_annex_operations.mdwn | 6 +++++- 8 files changed, 36 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index eb48a476b..745597bb0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ git-annex (6.20160908) UNRELEASED; urgency=medium * addurl, get: Added --json-progress option, which adds progress objects to the json output. * Remove key:null from git-annex add --json output. + * copy, move, mirror: Support --json and --json-progress. -- Joey Hess Thu, 08 Sep 2016 12:48:55 -0400 diff --git a/Command/Copy.hs b/Command/Copy.hs index f48f579ef..56278bde2 100644 --- a/Command/Copy.hs +++ b/Command/Copy.hs @@ -14,7 +14,7 @@ import Annex.Wanted import Annex.NumCopies cmd :: Command -cmd = withGlobalOptions (jobsOption : annexedMatchingOptions) $ +cmd = withGlobalOptions (jobsOption : jsonOption : jsonProgressOption : annexedMatchingOptions) $ command "copy" SectionCommon "copy content of files to/from another repository" paramPaths (seek <--< optParser) diff --git a/Command/Mirror.hs b/Command/Mirror.hs index 1c7b6e396..d08555e79 100644 --- a/Command/Mirror.hs +++ b/Command/Mirror.hs @@ -17,7 +17,7 @@ import Annex.NumCopies import Types.Transfer cmd :: Command -cmd = withGlobalOptions ([jobsOption] ++ annexedMatchingOptions) $ +cmd = withGlobalOptions (jobsOption : jsonOption : jsonProgressOption : annexedMatchingOptions) $ command "mirror" SectionCommon "mirror content of files to/from another repository" paramPaths (seek <--< optParser) diff --git a/Command/Move.hs b/Command/Move.hs index 1ab566770..b44041f6c 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -20,7 +20,7 @@ import Annex.NumCopies import System.Log.Logger (debugM) cmd :: Command -cmd = withGlobalOptions (jobsOption : annexedMatchingOptions) $ +cmd = withGlobalOptions (jobsOption : jsonOption : jsonProgressOption : annexedMatchingOptions) $ command "move" SectionCommon "move content of files to/from another repository" paramPaths (seek <--< optParser) diff --git a/doc/git-annex-copy.mdwn b/doc/git-annex-copy.mdwn index e99f9848d..92eb1750b 100644 --- a/doc/git-annex-copy.mdwn +++ b/doc/git-annex-copy.mdwn @@ -72,6 +72,15 @@ Copies the content of files from or to another remote. The [[git-annex-matching-options]](1) can be used to specify files to copy. +* `--json` + + Enable JSON output. This is intended to be parsed by programs that use + git-annex. Each line of output is a JSON object. + +* `--json-progress` + + Include progress objects in JSON output. + # SEE ALSO [[git-annex]](1) diff --git a/doc/git-annex-mirror.mdwn b/doc/git-annex-mirror.mdwn index 77df17045..b7644a75d 100644 --- a/doc/git-annex-mirror.mdwn +++ b/doc/git-annex-mirror.mdwn @@ -66,6 +66,15 @@ contents. Use [[git-annex-sync]](1) for that. The [[git-annex-matching-options]](1) can be used to specify files to mirror. +* `--json` + + Enable JSON output. This is intended to be parsed by programs that use + git-annex. Each line of output is a JSON object. + +* `--json-progress` + + Include progress objects in JSON output. + # SEE ALSO [[git-annex]](1) diff --git a/doc/git-annex-move.mdwn b/doc/git-annex-move.mdwn index bac5719f1..d2595cfe8 100644 --- a/doc/git-annex-move.mdwn +++ b/doc/git-annex-move.mdwn @@ -55,6 +55,15 @@ Moves the content of files from or to another remote. The [[git-annex-matching-options]](1) can be used to specify files to move. +* `--json` + + Enable JSON output. This is intended to be parsed by programs that use + git-annex. Each line of output is a JSON object. + +* `--json-progress` + + Include progress objects in JSON output. + # SEE ALSO [[git-annex]](1) diff --git a/doc/todo/interface_to_the___34__progress__34___of_annex_operations.mdwn b/doc/todo/interface_to_the___34__progress__34___of_annex_operations.mdwn index 46e8ef75c..68125c53b 100644 --- a/doc/todo/interface_to_the___34__progress__34___of_annex_operations.mdwn +++ b/doc/todo/interface_to_the___34__progress__34___of_annex_operations.mdwn @@ -12,4 +12,8 @@ Related: > relay the progress messages when datalad is doing a nested retrieval, I > suppose.) --[[Joey]] ->> [[done]]; --json-progress implemented. --[[Joey]] +>> [[done]]; --json-progress implemented. I limited the frequency of json +>> progress items to 10 per second max, and it's typically only 1 per +>> second or less, so didn't implement +>> --json-progress=N to tune it. Also added --json and --json-progress to +>> copy, move, mirror commands. --[[Joey]] -- cgit v1.2.3