mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TW-1873: Specify different path to extensions/hooks directory
- Thanks to Eli.
This commit is contained in:
parent
77b3ee0561
commit
c300cff00f
6 changed files with 35 additions and 6 deletions
1
AUTHORS
1
AUTHORS
|
@ -303,3 +303,4 @@ suggestions:
|
||||||
bjonnh
|
bjonnh
|
||||||
OKOMper
|
OKOMper
|
||||||
eldios
|
eldios
|
||||||
|
Eli
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
(thanks to E. Manuel Cerr'on Angeles)
|
(thanks to E. Manuel Cerr'on Angeles)
|
||||||
- TW-1857 Change Task::get call to the more efficient Task::has
|
- TW-1857 Change Task::get call to the more efficient Task::has
|
||||||
(thanks to Zachary Manning).
|
(thanks to Zachary Manning).
|
||||||
|
- TW-1873 Specify different path to extensions/hooks directory
|
||||||
|
(thanks to Eli).
|
||||||
- Added 'juhannus' as a synonym for 'midsommarafton'
|
- Added 'juhannus' as a synonym for 'midsommarafton'
|
||||||
(thanks to Lynoure Braakman).
|
(thanks to Lynoure Braakman).
|
||||||
- Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY'
|
- Deprecated the 'DUETODAY' virtual tag, which is a synonym for the 'TODAY'
|
||||||
|
|
|
@ -180,6 +180,10 @@ shell meta character, which will be properly expanded.
|
||||||
|
|
||||||
Note that the TASKDATA environment variable overrides this setting.
|
Note that the TASKDATA environment variable overrides this setting.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B hooks.location=$HOME/.task/hooks
|
||||||
|
This is a path to the hook scripts directory. By default it is ~/.task/hooks.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B locking=1
|
.B locking=1
|
||||||
Determines whether to use file locking when accessing the pending.data and
|
Determines whether to use file locking when accessing the pending.data and
|
||||||
|
|
|
@ -532,7 +532,11 @@ void Config::createDefaultData (const std::string& data)
|
||||||
|
|
||||||
d.create ();
|
d.create ();
|
||||||
|
|
||||||
d += "hooks";
|
if (has ("hooks.location"))
|
||||||
|
d = Directory (get ("hooks.location"));
|
||||||
|
else
|
||||||
|
d += "hooks";
|
||||||
|
|
||||||
d.create ();
|
d.create ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,19 @@ void Hooks::initialize ()
|
||||||
{
|
{
|
||||||
_debug = context.config.getInteger ("debug.hooks");
|
_debug = context.config.getInteger ("debug.hooks");
|
||||||
|
|
||||||
// Scan <rc.data.location>/hooks
|
// Scan <rc.hooks.location>
|
||||||
Directory d (context.config.get ("data.location"));
|
// <rc.data.location>/hooks
|
||||||
d += "hooks";
|
Directory d;
|
||||||
|
if (context.config.has ("hooks.location"))
|
||||||
|
{
|
||||||
|
d = Directory (context.config.get ("hooks.location"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d = Directory (context.config.get ("data.location"));
|
||||||
|
d += "hooks";
|
||||||
|
}
|
||||||
|
|
||||||
if (d.is_directory () &&
|
if (d.is_directory () &&
|
||||||
d.readable ())
|
d.readable ())
|
||||||
{
|
{
|
||||||
|
|
|
@ -307,8 +307,16 @@ int CmdDiagnostics::execute (std::string& output)
|
||||||
<< "\n\n";
|
<< "\n\n";
|
||||||
|
|
||||||
// Display hook status.
|
// Display hook status.
|
||||||
Path hookLocation (context.config.get ("data.location"));
|
Path hookLocation;
|
||||||
hookLocation += "hooks";
|
if (context.config.has ("hooks.location"))
|
||||||
|
{
|
||||||
|
hookLocation = Path (context.config.get ("hooks.location"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hookLocation = Path (context.config.get ("data.location"));
|
||||||
|
hookLocation += "hooks";
|
||||||
|
}
|
||||||
|
|
||||||
out << bold.colorize (STRING_CMD_DIAG_HOOKS)
|
out << bold.colorize (STRING_CMD_DIAG_HOOKS)
|
||||||
<< '\n'
|
<< '\n'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue