mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
init: Added :yes as a hint to override confirmation
This commit is contained in:
parent
e8544a72ce
commit
adae77e99e
3 changed files with 10 additions and 4 deletions
|
@ -129,6 +129,8 @@ forms of feedback, for purposes of automation. The supported hints are:
|
|||
|
||||
:quiet Turns off all feedback. For automation
|
||||
:debug Runs in debug mode, shows many runtime details
|
||||
:yes Overrides confirmation by answering 'yes' to the questions
|
||||
|
||||
:color Force color on, even if not connected to a TTY
|
||||
:nocolor Force color off, even if connected to a TTY
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ int CmdHelp (const CLI& cli)
|
|||
<< '\n'
|
||||
<< " :quiet Turns off all feedback. For automation\n"
|
||||
<< " :debug Runs in debug mode, shows many runtime details\n"
|
||||
<< " :yes Overrides confirmation by answering 'yes' to the questions\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"
|
||||
|
|
11
src/init.cpp
11
src/init.cpp
|
@ -95,6 +95,7 @@ void initializeEntities (CLI& cli)
|
|||
cli.entity ("hint", ":fill");
|
||||
cli.entity ("hint", ":color");
|
||||
cli.entity ("hint", ":nocolor");
|
||||
cli.entity ("hint", ":yes");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -111,14 +112,16 @@ void initializeDataAndRules (
|
|||
// :quiet --> verbose=off
|
||||
// :color --> color=on
|
||||
// :nocolor --> color=off
|
||||
// :yes --> confirmation=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", "off");
|
||||
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", "off");
|
||||
if (arg.attribute ("canonical") == ":yes") rules.set ("confirmation", "off");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue