commit d1406b68219f7a0ee7450fcc0e2b925be4df20c8
parent 304929099989248e010105aa1f6268710456c285
Author: Pr0fiTX <uventik999@gmail.com>
Date: Sun, 17 Aug 2025 12:41:20 +0300
[ADD]: Implemented "-h" flag
Diffstat:
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/cdoto.c b/cdoto.c
@@ -3,7 +3,7 @@
#include <string.h>
#include <unistd.h>
-// CONSTANTS (PP)
+// CONSTANTS
#define TASK_TITLE_LEN 256
#define TASK_DESCRIPTION_LEN 1024
#define TASK_FILE_NAME "cdoto.txt"
@@ -15,11 +15,15 @@
#define TASK_DEFAULT_INIT {0, "Task", "-", ACTIVE}
/*
* h - help menu
- * c NAME [DESCRIPTION] - create task
+ * c TITLE DESCRIPTION - create task
* d ID - mark task with this ID as done
*/
#define ARGUMENTS "hc:d:"
+const char help_msg[] =
+ "HELP MENU:\n\nFlags:\n\t-h -- show this message\n\t-c TITLE DESCRIPTION "
+ "-- create new task\n\t-d ID -- mark task as DONE\n";
+
// STRUCTURES
typedef enum {
RET_NONVALID = -1, // For Numbers
@@ -384,7 +388,8 @@ int main(int argc, char *argv[]) {
}
return RET_SUCCESS;
case 'h':
- return RET_NOTIMPLEMENTED;
+ printf("%s", help_msg);
+ return RET_SUCCESS;
case 'd':
searhing_id = atoi(optarg);
// Loading tasks from file to the memory