From b276a86b46b0154ffb88681300175337dbbdf27f Mon Sep 17 00:00:00 2001 From: Thalia Archibald Date: Fri, 1 Nov 2024 02:41:15 -0700 Subject: [PATCH] Remove outdated FIXME This comment predates the addition of $ARGS in jq 1.6, so there was no way to access named arguments with an invalid identifier. Rather than forbid such names, update the manual to clarify. --- docs/content/manual/dev/manual.yml | 3 ++- jq.1.prebuilt | 4 ++-- src/main.c | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/content/manual/dev/manual.yml b/docs/content/manual/dev/manual.yml index 44fcfa0818..96a7269d5e 100644 --- a/docs/content/manual/dev/manual.yml +++ b/docs/content/manual/dev/manual.yml @@ -241,7 +241,8 @@ sections: bind `$foo` to `"123"`. Named arguments are also available to the jq program as - `$ARGS.named`. + `$ARGS.named`. When the name is not a valid identifier, this is + the only way to access it. * `--argjson name JSON-text`: diff --git a/jq.1.prebuilt b/jq.1.prebuilt index ee3ad2927c..4091cd20b3 100644 --- a/jq.1.prebuilt +++ b/jq.1.prebuilt @@ -1,5 +1,5 @@ . -.TH "JQ" "1" "October 2024" "" "" +.TH "JQ" "1" "November 2024" "" "" . .SH "NAME" \fBjq\fR \- Command\-line JSON processor @@ -181,7 +181,7 @@ Prepend \fBdirectory\fR to the search list for modules\. If this option is used This option passes a value to the jq program as a predefined variable\. If you run jq with \fB\-\-arg foo bar\fR, then \fB$foo\fR is available in the program and has the value \fB"bar"\fR\. Note that \fBvalue\fR will be treated as a string, so \fB\-\-arg foo 123\fR will bind \fB$foo\fR to \fB"123"\fR\. . .IP -Named arguments are also available to the jq program as \fB$ARGS\.named\fR\. +Named arguments are also available to the jq program as \fB$ARGS\.named\fR\. When the name is not a valid identifier, this is the only way to access it\. . .TP \fB\-\-argjson name JSON\-text\fR: diff --git a/src/main.c b/src/main.c index ffa4f1b274..372342c94c 100644 --- a/src/main.c +++ b/src/main.c @@ -454,7 +454,6 @@ int main(int argc, char* argv[]) { further_args_are_strings = 0; further_args_are_json = 1; } else if (isoption(&text, 0, "arg", is_short)) { - // FIXME: For --arg* we should check that the varname is acceptable if (i >= argc - 2) { fprintf(stderr, "%s: --arg takes two parameters (e.g. --arg varname value)\n", progname); die();