rmurl: Support --json and --json-error-messages
authorJoey Hess <joeyh@joeyh.name>
Thu, 4 May 2023 15:28:27 +0000 (11:28 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 4 May 2023 15:28:27 +0000 (11:28 -0400)
The json does not include an url field, but it does have an input field that is
"file url" when using --batch and ["file", "url"] when using the command line.
I chose not to change that because it would complicate batchInput.
An url field could be added if it turns out to be useful.

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
CHANGELOG
Command/Log.hs
Command/RmUrl.hs
doc/git-annex-rmurl.mdwn

index f539408f1437e02982df3826e702de28fdd599cb..d3de618e969890ce0ffb47e08f53b95e7b281585 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -37,7 +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.
+  * rmurl, unannex: Support --json and --json-error-messages.
 
  -- Joey Hess <id@joeyh.name>  Sat, 08 Apr 2023 13:57:18 -0400
 
index cbfe0edc82d6127f1d53cc46a72f652be1343b87..869090f4263cb5631f6a6b8fabdd64d0ca8fc512 100644 (file)
@@ -39,7 +39,7 @@ data LogChange = Added | Removed
 type Outputter = LogChange -> POSIXTime -> [UUID] -> Annex ()
 
 cmd :: Command
-cmd = withAnnexOptions [annexedMatchingOptions] $
+cmd = withAnnexOptions [jsonOptions, annexedMatchingOptions] $
        command "log" SectionQuery "shows location log"
                paramPaths (seek <$$> optParser)
 
index 0aa7f366582f9ab37b24cd393f665aa34300278d..d7a2b396fda642afe4efaf9c71d6c3afc48c6664 100644 (file)
@@ -12,7 +12,7 @@ import Logs.Web
 import Annex.WorkTree
 
 cmd :: Command
-cmd = notBareRepo $
+cmd = notBareRepo $ withAnnexOptions [jsonOptions] $
        command "rmurl" SectionCommon 
                "record file is not available at url"
                (paramRepeating (paramPair paramFile paramUrl))
index da0a6ba03c629a6d7e162ebc4e3f208239194568..8203b8ad97c1544321ae851504319447c0b2fe87 100644 (file)
@@ -28,6 +28,16 @@ for it, because the content may still be present on the remote.
   Makes the `--batch` input be delimited by nulls instead of the usual
   newlines.
 
+* `--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.
+
 * Also the [[git-annex-common-options]](1) can be used.
 
 # SEE ALSO