Skip to content

Commit 31f752e

Browse files
committed
Merge pull request #3 from micha/use-atsign-instead-of-qmark
Use @ instead of ? to discover keys.
2 parents 82abafe + 64d8ede commit 31f752e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ We'll use the following JSON data for the examples:
6565

6666
Print an object's keys:
6767

68-
$ echo "$JSON" | jt ?
68+
$ echo "$JSON" | jt @
6969
foo
7070
bar
7171
baz
7272

7373
Print a nested object's keys:
7474

75-
$ echo "$JSON" | jt bar ?
75+
$ echo "$JSON" | jt bar @
7676
x
7777

7878
Print the keys of the first object in a nested array:
7979

80-
$ echo "$JSON" | jt baz ?
80+
$ echo "$JSON" | jt baz @
8181
y
8282

8383
Print the indexes in a nested array:

jt.1.ronn

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The following commands are available:
100100
Print the array index at the top of the index stack. It is an error if the
101101
index stack is empty.
102102

103-
* `?`:
103+
* `@`:
104104
Print the keys of the object at the top of the data stack. It is an error
105105
if the item at the top of the data stack is not an object.
106106

@@ -167,19 +167,19 @@ We will use the following JSON input for the examples:
167167

168168
Explore JSON data, print an object's keys:
169169

170-
$ echo "$JSON" | jt ?
170+
$ echo "$JSON" | jt @
171171
foo
172172
bar
173173
baz
174174

175175
Print a nested object's keys:
176176

177-
$ echo "$JSON" | jt bar ?
177+
$ echo "$JSON" | jt bar @
178178
x
179179

180180
Print the keys of the first object in a nested array:
181181

182-
$ echo "$JSON" | jt baz ?
182+
$ echo "$JSON" | jt baz @
183183
y
184184

185185
Print the indexes in a nested array:

jt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ int run(char *js, int argc, char *argv[]) {
381381

382382
if (argc <= 0) return 0;
383383

384-
if (! strcmp(argv[0], "?")) {
384+
if (! strcmp(argv[0], "@")) {
385385
if (data && data->type == JSMN_OBJECT)
386386
obj_print_keys(js, data);
387387
exit(0);
@@ -428,7 +428,7 @@ void usage(int status) {
428428
fprintf(stderr, " jt -u <string>\n");
429429
fprintf(stderr, " jt -c [-js] [-i <file>] [-o <file>] COMMAND ...\n");
430430
fprintf(stderr, " jt [-js] [-i <file>] [-o <file>] [-F <char>] [-R <char>] COMMAND ...\n\n");
431-
fprintf(stderr, "Where COMMAND is one of `[', `]', `%%', `?', `^', or a property name.\n");
431+
fprintf(stderr, "Where COMMAND is one of `[', `]', `%%', `@', `^', or a property name.\n");
432432
exit(status);
433433
}
434434

0 commit comments

Comments
 (0)