@@ -19,7 +19,7 @@ static int usage()
19
19
printf ("commands\n\n" );
20
20
21
21
printf (" stat\n" );
22
- printf (" query [--kind 42] [--notekey key] [--search term] [--limit 42] \n" );
22
+ printf (" query [--kind 42] [--id abcdef...] [-- notekey key] [--search term] [--limit 42] \n" );
23
23
printf (" [-e abcdef...] [--author abcdef... -a bcdef...] [--relay wss://relay.damus.io]\n" );
24
24
printf (" profile <pubkey> print the raw profile data for a pubkey\n" );
25
25
printf (" note-relays <note-id> list the relays a given note id has been seen on\n" );
@@ -282,6 +282,23 @@ int main(int argc, char *argv[])
282
282
ndb_filter_end_field (f );
283
283
argv += 2 ;
284
284
argc -= 2 ;
285
+ } else if (!strcmp (argv [0 ], "-i" ) || !strcmp (argv [0 ], "--id" )) {
286
+ if (current_field != NDB_FILTER_IDS ) {
287
+ ndb_filter_end_field (f );
288
+ ndb_filter_start_field (f , NDB_FILTER_IDS );
289
+ current_field = NDB_FILTER_IDS ;
290
+ }
291
+
292
+ len = strlen (argv [1 ]);
293
+ if (len != 64 || !hex_decode (argv [1 ], 64 , tmp_id , sizeof (tmp_id ))) {
294
+ fprintf (stderr , "invalid hex id\n" );
295
+ res = 42 ;
296
+ goto cleanup ;
297
+ }
298
+
299
+ ndb_filter_add_id_element (f , tmp_id );
300
+ argv += 2 ;
301
+ argc -= 2 ;
285
302
} else if (!strcmp (argv [0 ], "-e" )) {
286
303
if (current_field != 'e' ) {
287
304
if (!ndb_filter_start_tag_field (f , 'e' )) {
@@ -307,14 +324,11 @@ int main(int argc, char *argv[])
307
324
argv += 2 ;
308
325
argc -= 2 ;
309
326
} else if (!strcmp (argv [0 ], "-a" ) || !strcmp (argv [0 ], "--author" )) {
310
- if (current_field ) {
311
- ndb_filter_end_field (f );
312
- current_field = 0 ;
313
- }
314
327
if (current_field != NDB_FILTER_AUTHORS ) {
328
+ ndb_filter_end_field (f );
315
329
ndb_filter_start_field (f , NDB_FILTER_AUTHORS );
330
+ current_field = NDB_FILTER_AUTHORS ;
316
331
}
317
- current_field = NDB_FILTER_AUTHORS ;
318
332
319
333
len = strlen (argv [1 ]);
320
334
if (len != 64 || !hex_decode (argv [1 ], 64 , tmp_id , sizeof (tmp_id ))) {
@@ -331,6 +345,10 @@ int main(int argc, char *argv[])
331
345
332
346
argv += 2 ;
333
347
argc -= 2 ;
348
+ } else {
349
+ fprintf (stderr , "unrecognized option: %s\n" , argv [0 ]);
350
+ res = 100 ;
351
+ goto cleanup ;
334
352
}
335
353
}
336
354
0 commit comments