mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
TW-1341
- TW-1341 confirmation config setting should apply to config command as well (thanks to Charles Ulrich).
This commit is contained in:
parent
f2a545bc25
commit
82e14c30bc
3 changed files with 11 additions and 4 deletions
|
@ -61,6 +61,8 @@ int CmdConfig::execute (std::string& output)
|
|||
// task config name # remove name
|
||||
if (words.size ())
|
||||
{
|
||||
bool confirmation = context.config.getBoolean ("confirmation");
|
||||
|
||||
std::string name = words[0];
|
||||
std::string value = "";
|
||||
|
||||
|
@ -100,7 +102,8 @@ int CmdConfig::execute (std::string& output)
|
|||
comment > pos))
|
||||
{
|
||||
found = true;
|
||||
if (confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value)))
|
||||
if (!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM, name, context.config.get (name), value)))
|
||||
{
|
||||
if (comment != std::string::npos)
|
||||
*line = name + "=" + json::encode (value) + " " + line->substr (comment);
|
||||
|
@ -114,7 +117,8 @@ int CmdConfig::execute (std::string& output)
|
|||
|
||||
// Not found, so append instead.
|
||||
if (!found &&
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value)))
|
||||
(!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM2, name, value))))
|
||||
{
|
||||
contents.push_back (name + "=" + json::encode (value));
|
||||
change = true;
|
||||
|
@ -139,7 +143,8 @@ int CmdConfig::execute (std::string& output)
|
|||
found = true;
|
||||
|
||||
// Remove name
|
||||
if (confirm (format (STRING_CMD_CONFIG_CONFIRM3, name)))
|
||||
if (!confirmation ||
|
||||
confirm (format (STRING_CMD_CONFIG_CONFIRM3, name)))
|
||||
{
|
||||
*line = "";
|
||||
change = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue