From 6a4b9779619171fdfa840ef62ef983be2efc46bd Mon Sep 17 00:00:00 2001 From: William Casarin Date: Tue, 13 Feb 2024 15:39:45 -0800 Subject: [PATCH] query: add -r (--raw) param This removes the envelope --- nostril-query | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nostril-query b/nostril-query index dd1f488..3288876 100755 --- a/nostril-query +++ b/nostril-query @@ -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)