The 'note' command now accepts -e and -.

This commit is contained in:
default 2023-02-05 19:54:41 +01:00
parent 7a2cce487c
commit f36fb45c3f

8
main.c
View file

@ -261,10 +261,11 @@ int main(int argc, char *argv[])
xs *c_msg = NULL; xs *c_msg = NULL;
char *in_reply_to = GET_ARGV(); char *in_reply_to = GET_ARGV();
if (strcmp(url, "-") == 0) { if (strcmp(url, "-e") == 0) {
/* get the content from an editor */ /* get the content from an editor */
FILE *f; FILE *f;
unlink("/tmp/snac-edit.txt");
system("$EDITOR /tmp/snac-edit.txt"); system("$EDITOR /tmp/snac-edit.txt");
if ((f = fopen("/tmp/snac-edit.txt", "r")) != NULL) { if ((f = fopen("/tmp/snac-edit.txt", "r")) != NULL) {
@ -278,6 +279,11 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
} }
else
if (strcmp(url, "-") == 0) {
/* get the content from stdin */
content = xs_readall(stdin);
}
else else
content = xs_dup(url); content = xs_dup(url);