summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAriadna Vigo <arivigodr@gmail.com>2020-06-27 19:34:37 +0200
committerAriadna Vigo <arivigodr@gmail.com>2020-06-27 19:34:37 +0200
commit027774217bd43700d0f30c54d27353a2fbf1e886 (patch)
tree2e461de420859b29f6147bd5c41aa47ad8cb2e69
parentae0050e28e4126c1570d95daf3879e612329b882 (diff)
Colors and task labels configurable in config.h
-rw-r--r--Makefile5
-rw-r--r--README.md5
-rw-r--r--config.def.h18
-rw-r--r--cras.c6
4 files changed, 28 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 0868099..ffa54b7 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,10 @@ options:
.c.o:
${CC} -c ${CFLAGS} $<
-${OBJ}: config.mk
+${OBJ}: config.h config.mk
+
+config.h:
+ cp config.def.h $@
cras: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
diff --git a/README.md b/README.md
index 64b4390..301a9ac 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,11 @@ Build by using:
$ make
```
+Customize the build process by changing config.mk to suit your needs.
+
+User configuration is performed by modifying config.h. A set of defaults is
+provided in config.def.h.
+
## Usage
### Set up your task list
diff --git a/config.def.h b/config.def.h
new file mode 100644
index 0000000..14c59a0
--- /dev/null
+++ b/config.def.h
@@ -0,0 +1,18 @@
+/* See LICENSE file for copyright and license details. */
+
+/*
+ * task_todo_color, task_done_color: colors in which task_todo_str and
+ * task_done_str, respectively, are to be printed in. Colors must be set using
+ * ANSI escape codes.
+ */
+static const char task_todo_color[] = "\033[31;1m"; /* Red */
+static const char task_done_color[] = "\033[32;1m"; /* Green */
+
+/*
+ * task_todo_str, task_done_str: the appearance of the status labels can be
+ * modified here.
+ */
+static const char task_todo_str[] = "[TODO]";
+static const char task_done_str[] = "[DONE]";
+
+
diff --git a/cras.c b/cras.c
index 31c847a..c92a8dc 100644
--- a/cras.c
+++ b/cras.c
@@ -10,6 +10,7 @@
static char *argv0; /* Required here by arg.h */
#include "arg.h"
+#include "config.h"
#include "tasklst.h"
#define NUMARG_SIZE 5 /* 4 digits + '\0' for the numerical arg of -t/-T */
@@ -39,11 +40,6 @@ static void set_tasks_mode(const char *crasfile);
static void output_mode(const char *crasfile, int mode, int color);
static void mark_tasks_mode(const char *crasfile, const char *id, int value);
-static const char task_todo_color[] = "\033[31;1m";
-static const char task_done_color[] = "\033[32;1m";
-static const char task_todo_str[] = "[TODO]";
-static const char task_done_str[] = "[DONE]";
-
static void die(const char *fmt, ...)
{
va_list ap;