diff options
| author | dam <dam@gudinoff> | 2022-10-02 00:22:53 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-10-02 00:22:53 +0000 |
| commit | 62294eb66c1ef061002165c692266d5d5f7f1cd1 (patch) | |
| tree | 33a99875b84701f661c838cbd2646f1b68ad59fd | |
| parent | 5c68228fbe958c6405573876de8f2956d6b9a23a (diff) | |
| download | task-time-tracker-62294eb66c1ef061002165c692266d5d5f7f1cd1.tar.zst task-time-tracker-62294eb66c1ef061002165c692266d5d5f7f1cd1.zip | |
Fixed argument checking on some argument driven actions.
| -rw-r--r-- | main.c | 8 | ||||
| -rw-r--r-- | readme.md | 11 |
2 files changed, 12 insertions, 7 deletions
@@ -1,6 +1,8 @@ // Compilation command: // - release: gcc main.c -Wall -Werror -pedantic -O2 -m64 -lncursesw -o ttt // - debug : gcc main.c -Wall -Werror -pedantic -g3 -m64 -lncursesw -o ttt -D DEBUG +// Usage hints: +// - To changes app data path change the environment variable HOME (USERPROFILE for windows users). #include <assert.h> @@ -996,8 +998,9 @@ int main(int argc, char *argv[]) { action = "--icsv"; do_action = strncmp(argv[idx], action, strlen(action)+1) == 0; if (do_action) { - if (argc < idx+1) { + if (idx+1 >= argc) { fprintf(stdout, "Missing CSV file path to import.\n"); + return EXIT_FAILURE; } load_database(&database, db_file_path); import_from_csv(&database, argv[idx+1]); @@ -1009,8 +1012,9 @@ int main(int argc, char *argv[]) { action = "--ecsv"; do_action = strncmp(argv[idx], action, strlen(action)+1) == 0; if (do_action) { - if (argc < idx+1) { + if (idx+1 >= argc) { fprintf(stdout, "Missing CSV file path to export.\n"); + return EXIT_FAILURE; } load_database(&database, db_file_path); export_to_csv(&database, argv[idx+1]); @@ -39,18 +39,19 @@ Task Time Tracker - [x] At startup, check for required files and create them if not present. - [x] Allow to archive task using keys: `a` and `A`; - [x] By default, store files on `~/.config/task_time_tracker/` or `~/.local/share/task_time_tracker` and allow to store elsewhere if passed by argument `--config`. -- [ ] Allow usage of `ttt: ./ttt --dpath ./` to change the app folder; +- [x] Allow usage of `ttt: ./ttt --dpath ./` to change the app folder: To changes app data path change the environment variable HOME (USERPROFILE for windows users). +- [ ] Clone (replicate) task; If task is active, mark newly created task as inactive; - [ ] Confirm delete_task operation. - [ ] Change task order (using task_t tmp_task + memcpy); -- [ ] Create task using keys: `c` and `C`; -- [ ] Delete task using keys: `d` and `D`; -- [ ] Change task name using keys: `F2`; - [ ] Add/remove time using keys: `F3`; - [ ] Add/remove time for any day of week; -- [ ] Clone (replicate) task using keys: `r` and `R`; If task is active, mark newly created task as inactive; - [ ] Implement logs as described above. - [ ] Go over all `TODO` items; - [ ] Rethink keys; + - [ ] Create task using keys: `c` and `C`; + - [ ] Delete task using keys: `d` and `D`; + - [ ] Change task name using keys: `F2`; + - [ ] Clone task using keys: `r` and `R`; - [ ] Cleanup `draw_tui`: - Selected and active tasks should be drawn after everything else. - Try printing each row; |
