mirror of
https://github.com/jb55/nostril.git
synced 2024-11-21 16:29:06 -05:00
fix kind parser
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
251031f5a5
commit
8898a0fe91
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
A cli util for creating nostr events
|
A cli util for creating nostr events
|
||||||
|
|
||||||
TODO: support for adding tags from the cli
|
|
||||||
|
|
||||||
## Dependenices
|
## Dependenices
|
||||||
|
|
||||||
`libsecp256k1` is the only dependency
|
`libsecp256k1` is the only dependency
|
||||||
|
|
|
@ -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->created_at = args->flags & HAS_CREATED_AT? args->created_at : time(NULL);
|
||||||
ev->content = args->content;
|
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)
|
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;
|
args->flags |= HAS_CREATED_AT;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(arg, "--kind")) {
|
} else if (!strcmp(arg, "--kind")) {
|
||||||
|
arg = *argv++; argc--;
|
||||||
if (!parse_num(arg, &n)) {
|
if (!parse_num(arg, &n)) {
|
||||||
fprintf(stderr, "kind should be a number, got '%s'\n", arg);
|
fprintf(stderr, "kind should be a number, got '%s'\n", arg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user