init: Added :yes as a hint to override confirmation

This commit is contained in:
Paul Beckingham 2016-05-03 00:29:28 -04:00
parent e8544a72ce
commit adae77e99e
3 changed files with 10 additions and 4 deletions

View file

@ -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

View file

@ -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"

View file

@ -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");
}
}