Make --list show number of updates for games that have been updated

Allows user to check for updated games more easily
This commit is contained in:
Sude 2017-01-11 19:22:38 +02:00
parent 6d6a676e0a
commit b9bb37b36a
3 changed files with 10 additions and 1 deletions

View File

@ -49,6 +49,7 @@ struct gameItem
std::string id;
std::vector<std::string> dlcnames;
Json::Value gamedetailsjson;
int updates = 0;
};
struct wishlistItem

View File

@ -597,7 +597,14 @@ int Downloader::listGames()
for (unsigned int i = 0; i < gameItems.size(); ++i)
{
std::cout << gameItems[i].name << std::endl;
std::string gamename = gameItems[i].name;
if (gameItems[i].updates > 0)
{
gamename += " [" + std::to_string(gameItems[i].updates) + "]";
if (config.bColor)
gamename = "\033[32m" + gamename + "\033[0m";
}
std::cout << gamename << std::endl;
for (unsigned int j = 0; j < gameItems[i].dlcnames.size(); ++j)
std::cout << "+> " << gameItems[i].dlcnames[j] << std::endl;
}

View File

@ -163,6 +163,7 @@ std::vector<gameItem> Website::getGames()
gameItem game;
game.name = product["slug"].asString();
game.id = product["id"].isInt() ? std::to_string(product["id"].asInt()) : product["id"].asString();
game.updates = product["updates"].isInt() ? product["updates"].asInt() : std::stoi(product["updates"].asString());
unsigned int platform = 0;
if (product["worksOn"]["Windows"].asBool())