mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-25 03:07:20 +02:00
- Task now supports "default.command" configuration variable (for example
it could contain "list due:tomorrow") that is the command that is run whenever task is invoked with no arguments.
This commit is contained in:
parent
e9a71b7db9
commit
fb87039d8c
6 changed files with 71 additions and 3 deletions
19
src/task.cpp
19
src/task.cpp
|
@ -299,10 +299,23 @@ int main (int argc, char** argv)
|
|||
if (conf.get ("command.logging") == "on")
|
||||
tdb.logCommand (argc, argv);
|
||||
|
||||
// Parse the command line.
|
||||
// If argc == 1 and the default.command configuration variable is set,
|
||||
// then use that, otherwise stick with argc/argv.
|
||||
std::vector <std::string> args;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
args.push_back (argv[i]);
|
||||
std::string defaultCommand = conf.get ("default.command");
|
||||
if (argc == 1 && defaultCommand != "")
|
||||
{
|
||||
// Stuff the command line.
|
||||
split (args, defaultCommand, ' ');
|
||||
std::cout << "[task " << defaultCommand << "]" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Parse the command line.
|
||||
for (int i = 1; i < argc; ++i)
|
||||
args.push_back (argv[i]);
|
||||
}
|
||||
|
||||
std::string command;
|
||||
T task;
|
||||
parse (args, command, task, conf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue