- 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 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 ---------------------------

2
NEWS
View file

@ -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

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,
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

View file

@ -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"

View file

@ -55,14 +55,17 @@ Hooks::~Hooks ()
////////////////////////////////////////////////////////////////////////////////
void Hooks::initialize ()
{
// Scan <rc.data.location>/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 <rc.data.location>/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 ());
}
}
}

View file

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