commit f58e2f03ab3acf5853d0fb9607c1d58c8c26827c
parent 0c2ded6eb803ccb1cf60746a3bb328c04ab5e31e
Author: brookjeynes <me@brookjeynes.dev>
Date: Thu, 11 Jun 2026 14:51:13 +1000
feat: add help menu
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/main.c b/main.c
@@ -10,10 +10,26 @@ struct options {
char priority;
};
+static void print_help(const char *program) {
+ printf("usage: %s [--priority A|-p A] <title> [properties]\n", program);
+ printf("\n");
+ printf("create a new task.\n");
+ printf("\n");
+ printf("options:\n");
+ printf(" -h, --help show this help\n");
+ printf(" -p, --priority A set priority A-Z\n");
+}
+
int main(int argc, char *argv[]) {
struct options cli_args = {0};
cli_args.priority = '\0';
+ if (argc > 1 &&
+ (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)) {
+ print_help(argv[0]);
+ return 0;
+ }
+
if (argc == 1) {
fprintf(stderr, "err: title required\n");
exit(1);