diff --git a/CHANGELOG b/CHANGELOG index a8d2a7476e..f539408f14 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 Sat, 08 Apr 2023 13:57:18 -0400 diff --git a/Command/Unannex.hs b/Command/Unannex.hs index 799a31ef8d..c6cb70793a 100644 --- a/Command/Unannex.hs +++ b/Command/Unannex.hs @@ -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) diff --git a/doc/git-annex-unannex.mdwn b/doc/git-annex-unannex.mdwn index 3b6c7d263d..157318de2c 100644 --- a/doc/git-annex-unannex.mdwn +++ b/doc/git-annex-unannex.mdwn @@ -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) diff --git a/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn b/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn index 2f071d93fb..b4c17a4783 100644 --- a/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn +++ b/doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn @@ -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 diff --git a/doc/todo/--json_for_unannex__and_ideally_any_other_command_/comment_1_9cc7829b4742f21077a27caad7ae638e._comment b/doc/todo/--json_for_unannex__and_ideally_any_other_command_/comment_1_9cc7829b4742f21077a27caad7ae638e._comment new file mode 100644 index 0000000000..8ec161dbc3 --- /dev/null +++ b/doc/todo/--json_for_unannex__and_ideally_any_other_command_/comment_1_9cc7829b4742f21077a27caad7ae638e._comment @@ -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. +"""]]