unannex: Support --json and --json-error-messages

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
Joey Hess 2023-05-03 15:56:20 -04:00
parent 7fc48fb348
commit 6cbcba484c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 129 additions and 1 deletions

View file

@ -37,6 +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.
* unannex: Support --json and --json-error-messages.
-- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400

View file

@ -22,7 +22,7 @@ import qualified Utility.RawFilePath as R
import System.PosixCompat.Files (linkCount)
cmd :: Command
cmd = withAnnexOptions [annexedMatchingOptions] $
cmd = withAnnexOptions [jsonOptions, annexedMatchingOptions] $
command "unannex" SectionUtility
"undo accidental add command"
paramPaths (withParams seek)

View file

@ -28,6 +28,16 @@ case you should use `git annex drop` instead, and you can also
But use --fast mode with caution, because editing the file will
change the content in the annex.
* `--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.
* file matching options
The [[git-annex-matching-options]](1)

View file

@ -2,3 +2,103 @@ While looking for various spots where `core.quotepath=true` is now treated by gi
[[!meta author=yoh]]
[[!tag projects/repronim]]
These commands have been updated to support --json:
* git-annex-unannex
Provisional list of commands that don't support --json and maybe should:
(Feel free to reorder things to the top)
* git-annex-addunused
* git-annex-adjust
* git-annex-assistant
* git-annex-backends
* git-annex-benchmark
* git-annex-calckey
* git-annex-checkpresentkey
* git-annex-common-options
* git-annex-config
* git-annex-configremote
* git-annex-contentlocation
* git-annex-dead
* git-annex-describe
* git-annex-diffdriver
* git-annex-direct
* git-annex-dropunused
* git-annex-edit
* git-annex-enable-tor
* git-annex-enableremote
* 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-log
* 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
* git-annex-rekey
* git-annex-remotedaemon
* git-annex-renameremote
* git-annex-repair
* git-annex-required
* git-annex-resolvemerge
* git-annex-restage
* git-annex-rmurl
* git-annex-schedule
* git-annex-semitrust
* git-annex-setkey
* git-annex-setpresentkey
* git-annex-shell
* git-annex-smudge
* git-annex-sync
* git-annex-test
* git-annex-testremote
* git-annex-transferkey
* git-annex-transferkeys
* git-annex-transferrer
* git-annex-trust
* git-annex-undo
* git-annex-ungroup
* git-annex-uninit
* git-annex-untrust
* git-annex-unused
* git-annex-upgrade
* git-annex-vadd
* git-annex-vcycle
* git-annex-version
* git-annex-vfilter
* git-annex-vicfg
* git-annex-view
* git-annex-vpop
* git-annex-wanted
* git-annex-watch
* git-annex-webapp
* git-annex-whereused

View file

@ -0,0 +1,17 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2023-05-03T19:33:50Z"
content="""
I agree generally, anything that is not already
explicitly machine parseable should support --json
(and --json-error-options will be available for free once that's added)
I'd exclude things like `git-annex find` which have
--format that can be used similarly; and a separate json
output would not be very useful for find anyway probably?
I've added a list of commands that currently don't support --json above.
Did unannex already, as it was trivial.
"""]]