diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-07 18:23:09 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-07 19:09:46 +0100 |
commit | 767214e4f157ae4a74be0b557bd49e24d972970b (patch) | |
tree | 46ee50d0e2c729e2892db8c96abc61294980a5fe /src/calcurse.h | |
parent | ddfe49d9feeba0d280e501f67cda64646e79d901 (diff) | |
download | calcurse-767214e4f157ae4a74be0b557bd49e24d972970b.zip |
Add pre-save and post-save hooks
This adds support for hooks which are executed before/after saving
calcurse data. Hooks can be placed under hooks/pre-save and
hooks/post-save in the data directory and need to be executable.
Potential use cases include:
* Automatically commit any changes to the data files using a VCS.
* Automatically sync with some sever component on data file changes.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/calcurse.h')
-rw-r--r-- | src/calcurse.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/calcurse.h b/src/calcurse.h index efbdb81..1ab5363 100644 --- a/src/calcurse.h +++ b/src/calcurse.h @@ -93,6 +93,7 @@ #define DPID_PATH_NAME ".daemon.pid" #define DLOG_PATH_NAME "daemon.log" #define NOTES_DIR_NAME "notes/" +#define HOOKS_DIR_NAME "hooks/" #define TODO_PATH DIR_NAME TODO_PATH_NAME #define APTS_PATH DIR_NAME APTS_PATH_NAME @@ -102,6 +103,7 @@ #define DLOG_PATH DIR_NAME DLOG_PATH_NAME #define DPID_PATH DIR_NAME DPID_PATH_NAME #define NOTES_DIR DIR_NAME NOTES_DIR_NAME +#define HOOKS_DIR DIR_NAME HOOKS_DIR_NAME #define DEFAULT_EDITOR "vi" #define DEFAULT_PAGER "less" @@ -779,6 +781,9 @@ int updatestring(WINDOW *, char **, int, int); /* help.c */ int display_help(const char *); +/* hooks.c */ +int run_hook(const char *); + /* ical.c */ void ical_import_data(FILE *, FILE *, unsigned *, unsigned *, unsigned *, unsigned *, unsigned *); @@ -1111,6 +1116,7 @@ extern char path_notes[BUFSIZ]; extern char path_cpid[BUFSIZ]; extern char path_dpid[BUFSIZ]; extern char path_dmon_log[BUFSIZ]; +extern char path_hooks[BUFSIZ]; extern struct conf conf; extern struct pad apad; extern struct nbar nbar; |