diff options
-rw-r--r-- | cras.1 | 8 | ||||
-rw-r--r-- | cras.c | 27 |
2 files changed, 33 insertions, 2 deletions
@@ -5,7 +5,7 @@ cras - The Anti-Procrastination Tool .SH SYNOPSIS .PP .B cras -.RB [ \-anov ] +.RB [ \-ainov ] .RB [ \-dtT .IR num ] .I file @@ -21,6 +21,10 @@ Append new tasks to .I file. (Be aware that this doesn't update the expiration date.) .TP +.B \-i +Force expiration of +.I file. +.TP .B \-n Create new .I file, @@ -57,6 +61,8 @@ date, which under the default configuration is 24 hours after originally saving it. Use -t to mark a task as done and -T to mark it back as pending. .PP You may delete tasks by using the -d option followed by its identifying number. +If you want to set the whole file as already expired, you may do so by using +the -i option. .PP Running cras with no options outputs the task list. For a summary, use the -o flag; this short-form output is suitable for printing to WM status bars. @@ -24,6 +24,7 @@ enum { enum { DEF_MODE, APP_MODE, + INVAL_MODE, NEW_MODE, OUT_MODE, DLT_MODE, @@ -45,6 +46,7 @@ static void input_mode(const char *crasfile, int append); static void output_mode(const char *crasfile, int mode); static void delete_mode(const char *crasfile, const char *id); static void mark_list_mode(const char *crasfile, const char *id, int value); +static void inval_mode(const char *crasfile); static void die(const char *fmt, ...) @@ -214,7 +216,7 @@ parse_tasknum(const char *id) static void usage(void) { - die("usage: cras [-anov] [-dtT num] file"); + die("usage: cras [-ainov] [-dtT num] file"); } static void @@ -308,6 +310,21 @@ mark_list_mode(const char *crasfile, const char *id, int value) task_lst_cleanup(&list); } +static void +inval_mode(const char *crasfile) +{ + TaskLst list; + + task_lst_init(&list); + read_crasfile(&list, crasfile); + + task_lst_set_expiration(&list, 0); + + write_crasfile(crasfile, list); + + task_lst_cleanup(&list); +} + int main(int argc, char *argv[]) { @@ -321,6 +338,11 @@ main(int argc, char *argv[]) usage(); mode = APP_MODE; break; + case 'i': + if (mode != DEF_MODE) + usage(); + mode = INVAL_MODE; + break; case 'n': if (mode != DEF_MODE) usage(); @@ -366,6 +388,9 @@ main(int argc, char *argv[]) case APP_MODE: input_mode(argv[0], 1); return 0; + case INVAL_MODE: + inval_mode(argv[0]); + return 0; case NEW_MODE: input_mode(argv[0], 0); return 0; |