From 3d2ab93b116f966b071e835a6656452cafc61aef Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 18 Feb 2015 18:38:11 -0600 Subject: [PATCH] Fix #705 (--argfile weirdness) --- docs/content/3.manual/manual.yml | 4 +++- main.c | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml index 67dd2c60..bab0eba3 100644 --- a/docs/content/3.manual/manual.yml +++ b/docs/content/3.manual/manual.yml @@ -218,7 +218,9 @@ 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 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. - title: Basic filters entries: diff --git a/main.c b/main.c index 76525723..77469a06 100644 --- a/main.c +++ b/main.c @@ -316,8 +316,6 @@ 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