fix kind parser

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin 2022-04-21 06:01:52 -07:00
parent 251031f5a5
commit 8898a0fe91
2 changed files with 2 additions and 3 deletions

View File

@ -3,8 +3,6 @@
A cli util for creating nostr events
TODO: support for adding tags from the cli
## Dependenices
`libsecp256k1` is the only dependency

View File

@ -339,7 +339,7 @@ static void make_event_from_args(struct nostr_event *ev, struct args *args)
{
ev->created_at = args->flags & HAS_CREATED_AT? args->created_at : time(NULL);
ev->content = args->content;
ev->kind = 1;
ev->kind = args->flags & HAS_KIND ? args->kind : 1;
}
static int parse_num(const char *arg, uint64_t *t)
@ -388,6 +388,7 @@ static int parse_args(int argc, const char *argv[], struct args *args, struct no
args->flags |= HAS_CREATED_AT;
}
} else if (!strcmp(arg, "--kind")) {
arg = *argv++; argc--;
if (!parse_num(arg, &n)) {
fprintf(stderr, "kind should be a number, got '%s'\n", arg);
return 0;