summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2015-05-29 10:38:08 -0500
committerNicolas Williams <nico@cryptonector.com>2015-05-29 10:38:08 -0500
commit89c57f79362d65f0507f59ffdb0974b364e90416 (patch)
treed1cae03534bab871a7b580b86a3ffef7f8308a85
parent6af7857ccdb81e01320ca9437a8241003f917bba (diff)
Revert "Fix #705 (--argfile weirdness)"
-rw-r--r--docs/content/3.manual/manual.yml4
-rw-r--r--main.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml
index d55df30f..7fada7ed 100644
--- a/docs/content/3.manual/manual.yml
+++ b/docs/content/3.manual/manual.yml
@@ -215,9 +215,7 @@ sections:
value to the jq program as a predefined variable. If you run jq
with `--argfile foo bar`, then `$foo` is available in the
program and has the value resulting from parsing the content of
- the file named `bar`. The file is slurped. That means the
- value loaded will be an array of the top-level JSON values found
- in the file.
+ the file named `bar`.
- title: Basic filters
entries:
diff --git a/main.c b/main.c
index 627719b1..9623d2c9 100644
--- a/main.c
+++ b/main.c
@@ -320,6 +320,8 @@ int main(int argc, char* argv[]) {
ret = 2;
goto out;
}
+ if (jv_get_kind(data) == JV_KIND_ARRAY && jv_array_length(jv_copy(data)) == 1)
+ data = jv_array_get(data, 0);
arg = jv_object_set(arg, jv_string("value"), data);
program_arguments = jv_array_append(program_arguments, arg);
i += 2; // skip the next two arguments