diff options
author | Nicolas Williams <nico@cryptonector.com> | 2015-05-21 18:20:05 -0500 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2015-05-21 18:20:15 -0500 |
commit | a50e548cc5313c187483bc8fb1b95e1798e8ef65 (patch) | |
tree | 0c19fa794d3f49c05143968aab9c1ed5e2a8ab0c /builtin.c | |
parent | 4b258f7d31b34ff5d45fba431169e7fd4c995283 (diff) |
Fix error message for @tsv
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -375,11 +375,14 @@ static jv f_format(jq_state *jq, jv input, jv fmt) { return f_tostring(jq, input); } else if (!strcmp(fmt_s, "csv") || !strcmp(fmt_s, "tsv")) { const char *quotes, *sep, *escapings; + const char *msg; if (!strcmp(fmt_s, "csv")) { + msg = "cannot be csv-formatted, only array"; quotes = "\""; sep = ","; escapings = "\"\"\"\0"; } else { + msg = "cannot be tsv-formatted, only array"; assert(!strcmp(fmt_s, "tsv")); quotes = ""; sep = "\t"; @@ -387,7 +390,7 @@ static jv f_format(jq_state *jq, jv input, jv fmt) { } jv_free(fmt); if (jv_get_kind(input) != JV_KIND_ARRAY) - return type_error(input, "cannot be csv-formatted, only array"); + return type_error(input, msg); jv line = jv_string(""); jv_array_foreach(input, i, x) { if (i) line = jv_string_append_str(line, sep); |