fix: Support --json and --json-error-messages

And triaged out some commands that don't need to support these options.

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
Joey Hess 2023-05-04 14:28:21 -04:00
parent 46c7c30140
commit f20c8b087e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 39 additions and 16 deletions

View file

@ -37,7 +37,7 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
of core.sharedRepository and umask.
* initremote: Avoid creating a remote that is not encrypted when gpg is
broken.
* log, rmurl, unannex: Support --json and --json-error-messages.
* fix, log, rmurl, unannex: Support --json and --json-error-messages.
* log: When --raw-date is used, display only seconds from the epoch, as
documented, omitting a trailing "s" that was included in the output
before.

View file

@ -26,7 +26,7 @@ import Utility.Touch
#endif
cmd :: Command
cmd = noCommit $ withAnnexOptions [annexedMatchingOptions] $
cmd = noCommit $ withAnnexOptions [annexedMatchingOptions, jsonOptions] $
command "fix" SectionMaintenance
"fix up links to annexed content"
paramPaths (withParams seek)

View file

@ -24,6 +24,16 @@ configured by annex.thin.
The [[git-annex-matching-options]](1)
can be used to specify files to fix.
* `--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-error-messages`
Messages that would normally be output to standard error are included in
the JSON instead.
* Also the [[git-annex-common-options]](1) can be used.
# SEE ALSO

View file

@ -40,6 +40,16 @@ key. The `--historical` option makes it also find past versions of files.
It stops after finding one use of the key, and outputs a git rev that
refers to where it was used, eg "HEAD@{40}:somefile"
* `--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-error-messages`
Messages that would normally be output to standard error are included in
the JSON instead.
# SEE ALSO
[[git-annex]](1)

View file

@ -8,14 +8,15 @@ These commands have been updated to support --json:
* git-annex-unannex
* git-annex-rmurl
* git-annex-log
* git-annex-fix
Provisional list of commands that don't support --json and maybe should:
(Feel free to reorder things to the top)
* git-annex-whereused
* git-annex-addunused
* git-annex-adjust
* git-annex-assistant
* git-annex-backends
* git-annex-benchmark
* git-annex-calckey
@ -27,7 +28,6 @@ Provisional list of commands that don't support --json and maybe should:
* git-annex-dead
* git-annex-describe
* git-annex-diffdriver
* git-annex-direct
* git-annex-dropunused
* git-annex-edit
* git-annex-enable-tor
@ -35,33 +35,25 @@ Provisional list of commands that don't support --json and maybe should:
* git-annex-expire
* git-annex-filter-branch
* git-annex-filter-process
* git-annex-findref
* git-annex-fix
* git-annex-forget
* git-annex-fuzztest
* git-annex-group
* git-annex-groupwanted
* git-annex-importfeed
* git-annex-indirect
* git-annex-init
* git-annex-initremote
* git-annex-inprogress
* git-annex-list
* git-annex-lookupkey
* git-annex-map
* git-annex-matchexpression
* git-annex-matching-expression
* git-annex-matching-options
* git-annex-merge
* git-annex-migrate
* git-annex-mincopies
* git-annex-multicast
* git-annex-numcopies
* git-annex-p2p
* git-annex-post-receive
* git-annex-pre-commit
* git-annex-preferred-content
* git-annex-proxy
* git-annex-readpresentkey
* git-annex-reinit
* git-annex-reinject
@ -76,8 +68,6 @@ Provisional list of commands that don't support --json and maybe should:
* git-annex-semitrust
* git-annex-setkey
* git-annex-setpresentkey
* git-annex-shell
* git-annex-smudge
* git-annex-sync
* git-annex-test
* git-annex-testremote
@ -100,5 +90,18 @@ Provisional list of commands that don't support --json and maybe should:
* git-annex-vpop
* git-annex-wanted
* git-annex-watch
* git-annex-webapp
* git-annex-whereused
These commands have been reviewed and should not support json:
* git-annex-list (because it's a compact display of whereis so no new information)
* git-annex-direct (deprecated noop)
* git-annex findref (same as find)
* git-annex indirect (deprecated noop)
* git-annex proxy (deprecated and displays git command output so nothing
structured)
* git-annex-pre-commit (used internally)
* git-annex-post-receive (used internally)
* git-annex-smudge (used internally)
* git-annex-shell (run by git)
* git-annex-assistant (too high level)
* git-annex-webapp (too high level)