From 64d8ede114fd0c728ab889717f9e7ac01c91d943 Mon Sep 17 00:00:00 2001 From: Alan Dipert Date: Fri, 26 Feb 2016 21:44:56 +0000 Subject: [PATCH] Use @ instead of ? to discover keys. --- README.md | 6 +++--- jt.1.ronn | 8 ++++---- jt.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9d736d8..5ff3b5c 100644 --- a/README.md +++ b/README.md @@ -65,19 +65,19 @@ We'll use the following JSON data for the examples: Print an object's keys: - $ echo "$JSON" | jt ? + $ echo "$JSON" | jt @ foo bar baz Print a nested object's keys: - $ echo "$JSON" | jt bar ? + $ echo "$JSON" | jt bar @ x Print the keys of the first object in a nested array: - $ echo "$JSON" | jt baz ? + $ echo "$JSON" | jt baz @ y Print the indexes in a nested array: diff --git a/jt.1.ronn b/jt.1.ronn index 1858127..422b03c 100644 --- a/jt.1.ronn +++ b/jt.1.ronn @@ -100,7 +100,7 @@ The following commands are available: Print the array index at the top of the index stack. It is an error if the index stack is empty. - * `?`: + * `@`: Print the keys of the object at the top of the data stack. It is an error if the item at the top of the data stack is not an object. @@ -167,19 +167,19 @@ We will use the following JSON input for the examples: Explore JSON data, print an object's keys: - $ echo "$JSON" | jt ? + $ echo "$JSON" | jt @ foo bar baz Print a nested object's keys: - $ echo "$JSON" | jt bar ? + $ echo "$JSON" | jt bar @ x Print the keys of the first object in a nested array: - $ echo "$JSON" | jt baz ? + $ echo "$JSON" | jt baz @ y Print the indexes in a nested array: diff --git a/jt.c b/jt.c index a0959fc..b2981e2 100644 --- a/jt.c +++ b/jt.c @@ -381,7 +381,7 @@ int run(char *js, int argc, char *argv[]) { if (argc <= 0) return 0; - if (! strcmp(argv[0], "?")) { + if (! strcmp(argv[0], "@")) { if (data && data->type == JSMN_OBJECT) obj_print_keys(js, data); exit(0); @@ -428,7 +428,7 @@ void usage(int status) { fprintf(stderr, " jt -u \n"); fprintf(stderr, " jt -c [-js] [-i ] [-o ] COMMAND ...\n"); fprintf(stderr, " jt [-js] [-i ] [-o ] [-F ] [-R ] COMMAND ...\n\n"); - fprintf(stderr, "Where COMMAND is one of `[', `]', `%%', `?', `^', or a property name.\n"); + fprintf(stderr, "Where COMMAND is one of `[', `]', `%%', `@', `^', or a property name.\n"); exit(status); }