mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
CLI/CmdCalendar
- When the binary is named (or symlinked to) 'cal', then CLI::_args[0] must be clobbered, and restored for subsequent commands.
This commit is contained in:
parent
13b1982efd
commit
f28ccdc8b1
2 changed files with 10 additions and 0 deletions
|
@ -411,6 +411,12 @@ void CLI::analyze (bool parse /* = true */, bool strict /* = false */)
|
||||||
}
|
}
|
||||||
|
|
||||||
_args.push_back (a);
|
_args.push_back (a);
|
||||||
|
|
||||||
|
if (a.hasTag ("CALENDAR"))
|
||||||
|
{
|
||||||
|
A cal ("argCal", "calendar");
|
||||||
|
_args.push_back (cal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.config.getInteger ("debug.parser") >= 3)
|
if (context.config.getInteger ("debug.parser") >= 3)
|
||||||
|
|
|
@ -335,7 +335,11 @@ int CmdCalendar::execute (std::string& output)
|
||||||
if (context.commands.find (report) == context.commands.end ())
|
if (context.commands.find (report) == context.commands.end ())
|
||||||
throw std::string (STRING_ERROR_DETAILS);
|
throw std::string (STRING_ERROR_DETAILS);
|
||||||
|
|
||||||
|
// If the executable was "cal" or equivalent, replace it with "task".
|
||||||
std::string executable = context.cli._args[0].attribute ("raw");
|
std::string executable = context.cli._args[0].attribute ("raw");
|
||||||
|
std::string::size_type cal = executable.find ("cal");
|
||||||
|
if (cal != std::string::npos)
|
||||||
|
executable = executable.substr (0, cal) + PACKAGE;
|
||||||
|
|
||||||
std::vector <std::string> args;
|
std::vector <std::string> args;
|
||||||
args.push_back (executable);
|
args.push_back (executable);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue