mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 00:43:07 +02:00
Bug #590
- Applied patch to fix bug #590, which makes the yes/no/all/quit confirmation prompts consistent (thanks to Steve Rader). - Patch modified to work with autocomplete. Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
parent
b553954d37
commit
e2d11d8575
3 changed files with 18 additions and 8 deletions
|
@ -59,6 +59,8 @@
|
|||
Steve Rader).
|
||||
+ Fixed bug #589, where the man page did not adequately describe searching
|
||||
or usage of attribute modifiers (thanks to Steve Rader).
|
||||
+ Applied patch to fix bug #590, which makes the yes/no/all/quit confirmation
|
||||
prompts consistent (thanks to Steve Rader).
|
||||
+ Fixed bug #595, where taskwarrior ignored changes to the wait date during
|
||||
the edit command, consequently not changing task status (thanks to Eric
|
||||
Fluger).
|
||||
|
|
16
src/util.cpp
16
src/util.cpp
|
@ -83,8 +83,10 @@ int confirm3 (const std::string& question)
|
|||
{
|
||||
std::vector <std::string> options;
|
||||
options.push_back ("Yes");
|
||||
options.push_back ("yes");
|
||||
options.push_back ("no");
|
||||
options.push_back ("All");
|
||||
options.push_back ("all");
|
||||
|
||||
std::string answer;
|
||||
std::vector <std::string> matches;
|
||||
|
@ -93,9 +95,9 @@ int confirm3 (const std::string& question)
|
|||
{
|
||||
std::cout << question
|
||||
<< " ("
|
||||
<< options[0] << "/"
|
||||
<< options[1] << "/"
|
||||
<< options[2]
|
||||
<< options[2] << "/"
|
||||
<< options[4]
|
||||
<< ") ";
|
||||
|
||||
std::getline (std::cin, answer);
|
||||
|
@ -105,7 +107,9 @@ int confirm3 (const std::string& question)
|
|||
while (matches.size () != 1);
|
||||
|
||||
if (matches[0] == "Yes") return 1;
|
||||
else if (matches[0] == "yes") return 1;
|
||||
else if (matches[0] == "All") return 2;
|
||||
else if (matches[0] == "all") return 2;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
@ -118,8 +122,10 @@ int confirm4 (const std::string& question)
|
|||
{
|
||||
std::vector <std::string> options;
|
||||
options.push_back ("Yes");
|
||||
options.push_back ("yes");
|
||||
options.push_back ("no");
|
||||
options.push_back ("All");
|
||||
options.push_back ("all");
|
||||
options.push_back ("quit");
|
||||
|
||||
std::string answer;
|
||||
|
@ -129,10 +135,10 @@ int confirm4 (const std::string& question)
|
|||
{
|
||||
std::cout << question
|
||||
<< " ("
|
||||
<< options[0] << "/"
|
||||
<< options[1] << "/"
|
||||
<< options[2] << "/"
|
||||
<< options[3]
|
||||
<< options[4] << "/"
|
||||
<< options[5]
|
||||
<< ") ";
|
||||
|
||||
std::getline (std::cin, answer);
|
||||
|
@ -142,7 +148,9 @@ int confirm4 (const std::string& question)
|
|||
while (matches.size () != 1);
|
||||
|
||||
if (matches[0] == "Yes") return 1;
|
||||
else if (matches[0] == "yes") return 1;
|
||||
else if (matches[0] == "All") return 2;
|
||||
else if (matches[0] == "all") return 2;
|
||||
else if (matches[0] == "quit") return 3;
|
||||
else return 0;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ like ($output, qr/Task not deleted\./, 'confirmation - N works');
|
|||
|
||||
# Test Yes for multiple changes
|
||||
$output = qx{echo -e "y\nY\nY\nY\nY" | ../src/task rc:confirm.rc 7-10 +bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 8 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 9 "foo"/, 'multiple confirmations - Y works');
|
||||
|
@ -102,7 +102,7 @@ like ($output, qr/Modified 4 tasks/, 'multiple confirmations - Y works');
|
|||
|
||||
# Test no for multiple changes
|
||||
$output = qx{echo -e "N\nn\nn\nn\nn" | ../src/task rc:confirm.rc 7-10 -bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 8 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 9 "foo"/, 'multiple confirmations - n works');
|
||||
|
@ -111,14 +111,14 @@ like ($output, qr/Modified 0 tasks/, 'multiple confirmations - n works');
|
|||
|
||||
# Test All for multiple changes
|
||||
$output = qx{echo -e "a\nA" | ../src/task rc:confirm.rc 7-10 -bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - A works');
|
||||
like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - A works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - A works');
|
||||
unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - A works');
|
||||
like ($output, qr/Modified 4 tasks/, 'multiple confirmations - A works');
|
||||
|
||||
# Test quit for multiple changes
|
||||
$output = qx{echo "q" | ../src/task rc:confirm.rc 7-10 +bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - q works');
|
||||
like ($output, qr/Proceed with change\? \(yes\/no\/all\/quit\)/, 'multiple confirmations - q works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - q works');
|
||||
unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - q works');
|
||||
like ($output, qr/Modified 0 tasks/, 'multiple confirmations - q works');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue