add -t hashtag helper

This commit is contained in:
William Casarin 2022-11-16 21:11:33 -08:00
parent 02ab7a19d1
commit 1904c78efa

View File

@ -85,6 +85,7 @@ void usage()
printf(" --tag <key> <value> add a tag\n");
printf(" -e <event_id> shorthand for --tag e <event_id>\n");
printf(" -p <pubkey> shorthand for --tag p <pubkey>\n");
printf(" -t <hashtag> shorthand for --tag t <hashtag>\n");
exit(1);
}
@ -474,6 +475,13 @@ static int parse_args(int argc, const char *argv[], struct args *args, struct no
fprintf(stderr, "couldn't add p tag");
return 0;
}
} else if (!strcmp(arg, "-t")) {
has_added_tags = 1;
arg = *argv++; argc--;
if (!nostr_add_tag(ev, "t", arg)) {
fprintf(stderr, "couldn't add t tag");
return 0;
}
} else if (!strcmp(arg, "--tag")) {
has_added_tags = 1;
if (args->tags) {