addunused, dropunused: Support --json and --json-error-messages

This also changes addunused to display the names of the files that it adds.
That seems like a general usability improvement, and not displaying the input
number does not seem likely to be a problem to a user, since the filename
is based on the key. Displaying the filename was necessary to get it and the key
included in the json.

dropunused does not include the key in the json. It would be possible to
add, but would need more changes. And I doubt that dropunused --json
would be used in a situation where a program cared which keys were
dropped. Note that drop --unused does have the key in its json, so such
a program could just use it. Or could just dropkey --batch with the
specific keys it wants to drop if it cares about specific keys.

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
Joey Hess 2023-05-05 14:01:40 -04:00
parent 972fd05688
commit 1a9af823bc
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 69 additions and 39 deletions

View file

@ -23,16 +23,16 @@ These commands have been updated to support --json:
* git-annex-rekey
* git-annex-undo
* git-annex-migrate
* git-annex-addunused
* git-annex-dropunused
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-configremote
* git-annex-dead
* git-annex-dropunused
* git-annex-enableremote
* git-annex-expire
* git-annex-importfeed