registerurl,unregisterurl: rework output and support --json

* registerurl, unregisterurl: Improved output when reading from stdin
  to be more like other batch commands.
* registerurl, unregisterurl: Added --json and --json-error-messages options.

Note that this did change the --batch output in a way that could possibly
break something that expected the old output to never change. I think it's
acceptable to break that because there has never been a guarantee of
unchanging output format except with --batch for most commands. The old
output was just really weird too!

One possible wart is that "git-annex registerurl" with no options now
seems to just hang, since it's waiting for stdin input. Before, it said
"registerurl (stdin)" which was clearer about what's happenening. But this
is a deprecated mode anyway, --batch makes clear what's happening. If
anything, this problem would be a reason to eventually remove the support
for reading from stdin w/o --batch.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-02-14 13:29:20 -04:00
parent 291dc0d1a9
commit 0edf01d7d4
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 74 additions and 44 deletions

View file

@ -4,3 +4,11 @@
[[!meta author=yoh]]
[[!tag projects/datalad]]
> Added --json and --json-error-messages. Note that this did change the
> --batch output in a way that could possibly break something that expected
> the old output to never change. I think it's acceptable to break that
> because there has never been a guarantee of unchanging output format
> except with --batch for most commands.
>
> [[done]] --[[Joey]]

View file

@ -14,7 +14,8 @@ a behavior change. Urk.
Aside from crashing if an invalid key is provided,
or perhaps some other exceptional error, there are no real ways it could
fail so --json-error-messages is unlikely to be useful.
fail so --json-error-messages is unlikely to be useful. But adding --json
always adds it anyway.
(unregisterurl has the same interface and mostly same implementation,
and so same problems as registerurl.)