From 36bdd81d4694f87a8334b2316719b1f0bd5d34bb Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 26 Sep 2021 21:07:21 -0400 Subject: [PATCH] CmdNews: Prompt user to determine whether to show abbreviated summary --- src/commands/CmdNews.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/commands/CmdNews.cpp b/src/commands/CmdNews.cpp index 4aa00a804..8975571da 100644 --- a/src/commands/CmdNews.cpp +++ b/src/commands/CmdNews.cpp @@ -76,6 +76,28 @@ int CmdNews::execute (std::string& output) auto words = Context::getContext ().cli2.getWords (); auto config = Context::getContext ().config; + // Determine whether to use full or short summary + std::vector options {"full", "short"}; + std::vector matches; + + signal (SIGINT, signal_handler); + + do + { + std::cout << "Do you want to see full summary (11 features) or a short one (5 features)? (full/short) "; + + std::string answer; + std::getline (std::cin, answer); + answer = std::cin.eof () ? "full" : lowerCase (trim (answer)); + + autoComplete (answer, options, matches, 1); // Hard-coded 1. + } + while (! std::cin.eof () && matches.size () != 1); + + signal (SIGINT, SIG_DFL); + bool full_summary = matches.size () == 1 && matches[0] == "full" ? true : false; + + // Print release notes std::cout << "Taskwarrior 2.6.0 Release Notes" << std::endl; wait_for_keypress ();