Review: Now stops after 'limit' tasks

This commit is contained in:
Paul Beckingham 2016-09-04 12:48:21 -04:00
parent a84e00175c
commit 61886b29ef

View file

@ -29,6 +29,7 @@
#include <sstream> #include <sstream>
#include <vector> #include <vector>
#include <string> #include <string>
#include <algorithm>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
@ -174,10 +175,10 @@ static const std::string menu ()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static void reviewLoop (const std::vector <std::string>& uuids, int limit) static void reviewLoop (const std::vector <std::string>& uuids, unsigned int limit)
{ {
auto reviewed = 0; unsigned int reviewed = 0;
auto total = uuids.size (); auto total = std::min (static_cast <unsigned int> (uuids.size ()), limit);
auto width = getWidth (); auto width = getWidth ();
if (total == 0) if (total == 0)
@ -238,7 +239,7 @@ static void reviewLoop (const std::vector <std::string>& uuids, int limit)
int cmdReview (const std::vector <std::string>& args) int cmdReview (const std::vector <std::string>& args)
{ {
// Is there a specified limit? // Is there a specified limit?
auto limit = 0; unsigned int limit = 0;
if (args.size () == 2) if (args.size () == 2)
limit = strtol (args[1].c_str (), NULL, 10); limit = strtol (args[1].c_str (), NULL, 10);