From 99425e48e1c53595a9ff4d66c819c6d46c6d2bdc Mon Sep 17 00:00:00 2001 From: yuzu-eva Date: Thu, 19 Dec 2024 17:58:21 +0100 Subject: added help flag -h --- main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index 129aa04..b37cd63 100644 --- a/main.c +++ b/main.c @@ -26,6 +26,7 @@ void print_help() printf(" -s Search for a specific anime by name \n"); printf(" -a Append new anime and episode to file \n"); printf(" -e Edit the episode number of an anime \n"); + printf(" -h Print this help menu \n"); printf("\n"); } @@ -204,12 +205,13 @@ int main(int argc, char **argv) { mode_e mode; int opt; - while ((opt = getopt(argc, argv, "msae")) != -1) { + while ((opt = getopt(argc, argv, "msaeh")) != -1) { switch (opt) { case 'm': mode = MATCH_MODE; break; case 's': mode = SEARCH_MODE; break; case 'a': mode = APPEND_MODE; break; case 'e': mode = EDIT_MODE; break; + case 'h': print_help(); exit(EXIT_SUCCESS); default: print_help(); exit(EXIT_FAILURE); -- cgit v1.2.3