mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
add --new option and color
This commit is contained in:
parent
cdc3569f3c
commit
196c45ef1e
@ -235,6 +235,7 @@ class Config
|
||||
bool bDownload;
|
||||
bool bRepair;
|
||||
bool bUpdated;
|
||||
bool bNew;
|
||||
bool bCheckStatus;
|
||||
bool bShowWishlist;
|
||||
bool bNotifications;
|
||||
|
1
main.cpp
1
main.cpp
@ -208,6 +208,7 @@ int main(int argc, char *argv[])
|
||||
("create-xml", bpo::value<std::string>(&Globals::globalConfig.sXMLFile)->implicit_value("automatic"), "Create GOG XML for file\n\"automatic\" to enable automatic XML creation")
|
||||
("notifications", bpo::value<bool>(&Globals::globalConfig.bNotifications)->zero_tokens()->default_value(false), "Check notifications")
|
||||
("updated", bpo::value<bool>(&Globals::globalConfig.bUpdated)->zero_tokens()->default_value(false), "List/download only games with update flag set")
|
||||
("new", bpo::value<bool>(&Globals::globalConfig.bNew)->zero_tokens()->default_value(false), "List/download only games with new flag set")
|
||||
("clear-update-flags", bpo::value<bool>(&bClearUpdateNotifications)->zero_tokens()->default_value(false), "Clear update notification flags")
|
||||
("check-orphans", bpo::value<std::string>(&Globals::globalConfig.sOrphanRegex)->implicit_value(""), check_orphans_text.c_str())
|
||||
("status", bpo::value<bool>(&Globals::globalConfig.bCheckStatus)->zero_tokens()->default_value(false), "Show status of files\n\nOutput format:\nstatuscode gamename filename filesize filehash\n\nStatus codes:\nOK - File is OK\nND - File is not downloaded\nMD5 - MD5 mismatch, different version\nFS - File size mismatch, incomplete download\n\nSee also --no-fast-status-check option")
|
||||
|
@ -533,8 +533,14 @@ int Downloader::listGames()
|
||||
if (gameItems[i].updates > 0)
|
||||
{
|
||||
gamename += " [" + std::to_string(gameItems[i].updates) + "]";
|
||||
std::string color = gameItems[i].isnew ? "01;34" : "32";
|
||||
if (Globals::globalConfig.bColor)
|
||||
gamename = "\033[32m" + gamename + "\033[0m";
|
||||
gamename = "\033[" + color + "m" + gamename + "\033[0m";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Globals::globalConfig.bColor && gameItems[i].isnew)
|
||||
gamename = "\033[01;34m" + gamename + "\033[0m";
|
||||
}
|
||||
std::cout << gamename << std::endl;
|
||||
for (unsigned int j = 0; j < gameItems[i].dlcnames.size(); ++j)
|
||||
|
@ -141,6 +141,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.isnew = product["isNew"].asBool();
|
||||
|
||||
if (product.isMember("updates"))
|
||||
{
|
||||
@ -175,6 +176,10 @@ std::vector<gameItem> Website::getGames()
|
||||
if (product["worksOn"]["Linux"].asBool())
|
||||
platform |= GlobalConstants::PLATFORM_LINUX;
|
||||
|
||||
// Skip if not new and flag is set
|
||||
if (Globals::globalConfig.bNew && !game.isnew)
|
||||
continue;
|
||||
|
||||
// Skip if platform doesn't match
|
||||
if (Globals::globalConfig.bPlatformDetection && !(platform & Globals::globalConfig.dlConf.iInstallerPlatform))
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user