initremote: Support --json and --json-error-messages

Including special --whatelse handling.

Otherwise, it seems unlikely to be too useful, but who knows.

Refactored code to call starting before displaying error messages.
This makes the error messages be captured by --json-error-messages

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
Joey Hess 2023-05-10 14:01:46 -04:00
parent 9812d9aaec
commit b3cc8dbacb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 96 additions and 41 deletions

View file

@ -39,12 +39,12 @@ These commands have been updated to support --json:
* git-annex-importfeed
* git-annex-merge
* git-annex-upgrade
* git-annex-initremote
Provisional list of commands that don't support --json and maybe should:
* git-annex-configremote
* git-annex-enableremote
* git-annex-initremote
These commands could support json, but I punted:

View file

@ -57,3 +57,5 @@ Looking at the [protocol](https://git-annex.branchable.com/design/external_speci
[[!meta author=yoh]]
[[!tag projects/datalad]]
> [[done]] --[[Joey]]

View file

@ -0,0 +1,14 @@
[[!comment format=mdwn
username="joey"
subject="""comment 2"""
date="2023-05-10T16:56:37Z"
content="""
I'm still not seeing much of an application for this, but since I've been
adding --json support to most git-annex commands anyway recently, and got
to initremote, I did go ahead and make --whatelse --json work.
Currently only the field name and description, and a description of the
allowed values are in there. It might be possible to add more information
like type or required or not, but I'd want to work with someone who was
consuming that information to do that.
"""]]