mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-27 12:16:25 +02:00
CmdHelp: Added :color/:nocolor hints
This commit is contained in:
parent
d0ec6fc4a8
commit
4ecc1e4f40
2 changed files with 13 additions and 4 deletions
|
@ -216,6 +216,9 @@ int CmdHelp (const CLI& cli)
|
|||
<< " :quiet Turns off all feedback. For automation\n"
|
||||
<< " :debug Runs in debug mode, shows many runtime details\n"
|
||||
<< "\n"
|
||||
<< " :color Force color on, even if not connected to a TTY\n"
|
||||
<< " :nocolor Force color off, even if connected to a TTY\n"
|
||||
<< "\n"
|
||||
<< " :day The 24-hours of the current day\n"
|
||||
<< " :week This week\n"
|
||||
<< " :month This month\n"
|
||||
|
|
10
src/init.cpp
10
src/init.cpp
|
@ -80,6 +80,8 @@ void initializeEntities (CLI& cli)
|
|||
cli.entity ("hint", ":quarter");
|
||||
cli.entity ("hint", ":year");
|
||||
cli.entity ("hint", ":fill");
|
||||
cli.entity ("hint", ":color");
|
||||
cli.entity ("hint", ":nocolor");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -89,14 +91,18 @@ void initializeDataAndRules (
|
|||
Rules& rules)
|
||||
{
|
||||
// Make common hints available via rules:
|
||||
// :debug --> debug
|
||||
// :quiet --> verbose
|
||||
// :debug --> debug=on
|
||||
// :quiet --> verbose=off
|
||||
// :color --> color=on
|
||||
// :nocolor --> color=off
|
||||
for (auto& arg : cli._args)
|
||||
{
|
||||
if (arg.hasTag ("HINT"))
|
||||
{
|
||||
if (arg.attribute ("canonical") == ":debug") rules.set ("debug", "on");
|
||||
if (arg.attribute ("canonical") == ":quiet") rules.set ("verbose", "off");
|
||||
if (arg.attribute ("canonical") == ":color") rules.set ("color", "on");
|
||||
if (arg.attribute ("canonical") == ":nocolor") rules.set ("color", "coff");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue