query: add -r (--raw) param

This removes the envelope
This commit is contained in:
William Casarin 2024-02-13 15:39:45 -08:00
parent 077b143614
commit 6a4b977961

View File

@ -5,6 +5,7 @@ import argparse
import json
parser = argparse.ArgumentParser(prog = 'nostril-query', description = 'Construct nostr queries')
parser.add_argument('-r', '--raw', action=argparse.BooleanOptionalAction)
parser.add_argument('-a', '--authors')
parser.add_argument('-p', '--mentions')
parser.add_argument('-e', '--references')
@ -60,5 +61,10 @@ if args.kinds is not None:
kinds = args.kinds.split(",")
filt["kinds"] = [a for a in map(lambda s: int(s), kinds)]
q = json.dumps(["REQ","nostril-query",filt])
q = ""
if args.raw is not None:
q = json.dumps(filt)
else:
q = json.dumps(["REQ","nostril-query",filt])
print(q)