diff --git a/ChangeLog b/ChangeLog index afc6a5009..a5874e937 100644 --- a/ChangeLog +++ b/ChangeLog @@ -196,6 +196,8 @@ - Removed unused tips files (thanks to dev-zero). - Removed shadow file feature, replacing it with an example hook scripts that performs the same function. +- Added rc.hooks, a master control setting for hooks processing, which defaults + to 'on'. ------ current release --------------------------- diff --git a/NEWS b/NEWS index 8b966aa1a..14ee8f839 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ New Features in taskwarrior 2.4.0 the urgency values of the dependency chain. - Listing breaks now supported. See 'man taskrc'. - New fish shell completion script. + - Hooks. New commands in taskwarrior 2.4.0 @@ -35,6 +36,7 @@ New configuration options in taskwarrior 2.4.0 potentially dangerous combination of write commands and empty filters. - New truncated_count column style for the description field which as the name says is a combination of the existing truncated and count styles. + - New 'hooks' setting is a master control switch for hook processing. Newly deprecated features in taskwarrior 2.4.0 diff --git a/doc/man/taskrc.5.in b/doc/man/taskrc.5.in index 1375eb101..eb3bdd4f4 100644 --- a/doc/man/taskrc.5.in +++ b/doc/man/taskrc.5.in @@ -182,6 +182,11 @@ don't change. Note that this should be used in the form of a command line override (task rc.gc=off ...), and not permanently used in the .taskrc file, as this significantly affects performance in the long term. +.TP +.B hooks=on +This master control switch enables hook script processing. The default value +is 'on', but certain extensions and environments may need to disable hooks. + .TP .B exit.on.missing.db=no When set to 'yes' causes the program to exit if the database (~/.task or diff --git a/src/Config.cpp b/src/Config.cpp index 3bbdb057f..ee977b933 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -64,6 +64,7 @@ std::string Config::_defaults = "locking=on # Use file-level locking\n" "gc=on # Garbage-collect data files - DO NOT CHANGE unless you are sure\n" "exit.on.missing.db=no # Whether to exit if ~/.task is not found\n" + "hooks=on # Master control switch for hooks\n" "\n" "# Terminal\n" "detection=on # Detects terminal width\n" diff --git a/src/Hooks.cpp b/src/Hooks.cpp index d3b10216b..d3f2e08cb 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -55,14 +55,17 @@ Hooks::~Hooks () //////////////////////////////////////////////////////////////////////////////// void Hooks::initialize () { - // Scan /hooks - Directory d (context.config.get ("data.location")); - d += "hooks"; - if (d.is_directory () && - d.readable ()) + if (context.config.getBoolean ("hooks")) { - _scripts = d.list (); - std::sort (_scripts.begin (), _scripts.end ()); + // Scan /hooks + Directory d (context.config.get ("data.location")); + d += "hooks"; + if (d.is_directory () && + d.readable ()) + { + _scripts = d.list (); + std::sort (_scripts.begin (), _scripts.end ()); + } } } diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index 901a2a576..552aaf70e 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -154,6 +154,7 @@ int CmdShow::execute (std::string& output) " extensions" " fontunderline" " gc" + " hooks" " hyphenate" " indent.annotation" " indent.report"