- Added a master control, rc.hooks, which defaults to 'on', but can be used
  to disable hook processing in general.
This commit is contained in:
Paul Beckingham 2014-09-08 01:22:35 -04:00
parent 150f72eed4
commit 78650ac8c3
6 changed files with 21 additions and 7 deletions

View file

@ -196,6 +196,8 @@
- Removed unused tips files (thanks to dev-zero). - Removed unused tips files (thanks to dev-zero).
- Removed shadow file feature, replacing it with an example hook scripts that - Removed shadow file feature, replacing it with an example hook scripts that
performs the same function. performs the same function.
- Added rc.hooks, a master control setting for hooks processing, which defaults
to 'on'.
------ current release --------------------------- ------ current release ---------------------------

2
NEWS
View file

@ -20,6 +20,7 @@ New Features in taskwarrior 2.4.0
the urgency values of the dependency chain. the urgency values of the dependency chain.
- Listing breaks now supported. See 'man taskrc'. - Listing breaks now supported. See 'man taskrc'.
- New fish shell completion script. - New fish shell completion script.
- Hooks.
New commands in taskwarrior 2.4.0 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. potentially dangerous combination of write commands and empty filters.
- New truncated_count column style for the description field which as the - New truncated_count column style for the description field which as the
name says is a combination of the existing truncated and count styles. 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 Newly deprecated features in taskwarrior 2.4.0

View file

@ -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, override (task rc.gc=off ...), and not permanently used in the .taskrc file,
as this significantly affects performance in the long term. 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 .TP
.B exit.on.missing.db=no .B exit.on.missing.db=no
When set to 'yes' causes the program to exit if the database (~/.task or When set to 'yes' causes the program to exit if the database (~/.task or

View file

@ -64,6 +64,7 @@ std::string Config::_defaults =
"locking=on # Use file-level locking\n" "locking=on # Use file-level locking\n"
"gc=on # Garbage-collect data files - DO NOT CHANGE unless you are sure\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" "exit.on.missing.db=no # Whether to exit if ~/.task is not found\n"
"hooks=on # Master control switch for hooks\n"
"\n" "\n"
"# Terminal\n" "# Terminal\n"
"detection=on # Detects terminal width\n" "detection=on # Detects terminal width\n"

View file

@ -54,6 +54,8 @@ Hooks::~Hooks ()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Hooks::initialize () void Hooks::initialize ()
{
if (context.config.getBoolean ("hooks"))
{ {
// Scan <rc.data.location>/hooks // Scan <rc.data.location>/hooks
Directory d (context.config.get ("data.location")); Directory d (context.config.get ("data.location"));
@ -65,6 +67,7 @@ void Hooks::initialize ()
std::sort (_scripts.begin (), _scripts.end ()); std::sort (_scripts.begin (), _scripts.end ());
} }
} }
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// The on-launch event is triggered once, after initialization, before an // The on-launch event is triggered once, after initialization, before an

View file

@ -154,6 +154,7 @@ int CmdShow::execute (std::string& output)
" extensions" " extensions"
" fontunderline" " fontunderline"
" gc" " gc"
" hooks"
" hyphenate" " hyphenate"
" indent.annotation" " indent.annotation"
" indent.report" " indent.report"