init: Support --json and --json-error-messages
Dunno how useful this will be, since about all that's accessible from the json is whether it succeeded or failed, and the error messages which were already on stderr. Note that, when autoenabling a special remote, it would be possible for one to stop and prompt or output not using Messages and so not output as part of the json. I don't think that happens, but I'm not 100% sure something doesn't manage to break it. Of course, the same could be the case for commands that transfer objects. Using Annex.Init.autoEnableSpecialRemotes in --json mode would avoid the problem, but I've chosen to wait until I know it's needed to use it. Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
This commit is contained in:
parent
c208442292
commit
f09a248fe2
4 changed files with 17 additions and 4 deletions
|
@ -38,7 +38,7 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
|
|||
* initremote: Avoid creating a remote that is not encrypted when gpg is
|
||||
broken.
|
||||
* Support --json and --json-error-messages in more commands
|
||||
(addunused, dead, describe, dropunused, expire, fix, log, migrate,
|
||||
(addunused, dead, describe, dropunused, expire, fix, init, log, migrate,
|
||||
rekey, rmurl, semitrust, setpresentkey, trust, unannex, undo, untrust,
|
||||
unused)
|
||||
* log: When --raw-date is used, display only seconds from the epoch, as
|
||||
|
|
|
@ -19,7 +19,7 @@ import Control.Monad.Fail as Fail (MonadFail(..))
|
|||
import qualified Data.Map as M
|
||||
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $
|
||||
cmd = dontCheck repoExists $ withAnnexOptions [jsonOptions] $
|
||||
command "init" SectionSetup "initialize git-annex"
|
||||
paramDesc (seek <$$> optParser)
|
||||
|
||||
|
|
|
@ -57,6 +57,16 @@ to the user who tries to run git-annex init.
|
|||
|
||||
Do not enable special remotes that were configured with autoenable=true.
|
||||
|
||||
* `--json`
|
||||
|
||||
Enable JSON output. This is intended to be parsed by programs that use
|
||||
git-annex.
|
||||
|
||||
* `--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
|
||||
|
|
|
@ -32,6 +32,7 @@ These commands have been updated to support --json:
|
|||
* git-annex-dead
|
||||
* git-annex-describe
|
||||
* git-annex-unused
|
||||
* git-annex-init
|
||||
|
||||
Provisional list of commands that don't support --json and maybe should:
|
||||
|
||||
|
@ -39,8 +40,6 @@ Provisional list of commands that don't support --json and maybe should:
|
|||
|
||||
* git-annex-configremote
|
||||
* git-annex-enableremote
|
||||
* git-annex-importfeed
|
||||
* git-annex-init
|
||||
* git-annex-initremote
|
||||
* git-annex-merge
|
||||
* git-annex-reinit
|
||||
|
@ -57,6 +56,10 @@ These commands could support json, but I punted:
|
|||
* git-annex-version (--raw already exists, and the output is fairly machine
|
||||
parseable already. It would be possible to jsonize the output to make it
|
||||
possibly more machine parseable. But I'm doubtful that would be useful.
|
||||
* git-annex-importfeed (implemented w/o using usual command actions,
|
||||
which makes warning messages not get put in any particular json record.
|
||||
Same problem would also need to be fixed for [[doc/todo/importfeed_parallell]]
|
||||
btw.)
|
||||
|
||||
These commands have been reviewed and should not support json:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue