From 8dce7a3f0bd3f23a6f0aa826fec9cb1055c02108 Mon Sep 17 00:00:00 2001 From: Sude Date: Fri, 15 Nov 2024 19:33:10 +0200 Subject: [PATCH] Change --wishlist into --list option Remove --wishlist Add --list wishlist --- include/config.h | 1 - include/globalconstants.h | 4 +++- main.cpp | 5 +---- man/lgogdownloader.1 | 5 ++--- src/downloader.cpp | 4 ++++ 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/config.h b/include/config.h index f127135..84a7e38 100644 --- a/include/config.h +++ b/include/config.h @@ -242,7 +242,6 @@ class Config bool bUpdated; bool bNew; bool bCheckStatus; - bool bShowWishlist; bool bNotifications; bool bIncludeHiddenProducts; bool bSizeOnly; diff --git a/include/globalconstants.h b/include/globalconstants.h index 8dfc537..dd3b62b 100644 --- a/include/globalconstants.h +++ b/include/globalconstants.h @@ -108,6 +108,7 @@ namespace GlobalConstants const unsigned int LIST_FORMAT_TAGS = 1 << 3; const unsigned int LIST_FORMAT_TRANSFORMATIONS = 1 << 4; const unsigned int LIST_FORMAT_USERDATA = 1 << 5; + const unsigned int LIST_FORMAT_WISHLIST = 1 << 6; const std::vector LIST_FORMAT = { @@ -116,7 +117,8 @@ namespace GlobalConstants { LIST_FORMAT_DETAILS_JSON, "json", "JSON", "j|json" }, { LIST_FORMAT_TAGS, "tags", "Tags", "t|tags" }, { LIST_FORMAT_TRANSFORMATIONS, "transform", "Transformations", "tr|transform|transformations" }, - { LIST_FORMAT_USERDATA, "userdata", "User data", "ud|userdata" } + { LIST_FORMAT_USERDATA, "userdata", "User data", "ud|userdata" }, + { LIST_FORMAT_WISHLIST, "wishlist", "Wishlist", "w|wishlist" } }; const unsigned int GFTYPE_BASE_INSTALLER = 1 << 0; diff --git a/main.cpp b/main.cpp index fa8eb1a..aff0ef6 100644 --- a/main.cpp +++ b/main.cpp @@ -227,7 +227,6 @@ int main(int argc, char *argv[]) ("no-platform-detection", bpo::value(&bNoPlatformDetection)->zero_tokens()->default_value(false), "Don't try to detect supported platforms from game shelf.\nSkips the initial fast platform detection and detects the supported platforms from game details which is slower but more accurate.\nUseful in case platform identifier is missing for some games in the game shelf.\nUsing --platform with --list doesn't work with this option.") ("download-file", bpo::value(&Globals::globalConfig.sFileIdString)->default_value(""), "Download files using fileid\n\nFormat:\n\"gamename/fileid\"\n\"gamename/dlc_gamename/fileid\"\n\"gogdownloader://gamename/fileid\"\n\"gogdownloader://gamename/dlc_name/fileid\"\n\nMultiple files:\n\"gamename1/fileid1,gamename2/fileid2,gamename2/dlcname/fileid1\"\n\nThis option ignores all subdir options. The files are downloaded to directory specified with --directory option.") ("output-file,o", bpo::value(&Globals::globalConfig.sOutputFilename)->default_value(""), "Set filename of file downloaded with --download-file.") - ("wishlist", bpo::value(&Globals::globalConfig.bShowWishlist)->zero_tokens()->default_value(false), "Show wishlist") ("cacert", bpo::value(&Globals::globalConfig.curlConf.sCACertPath)->default_value(""), "Path to CA certificate bundle in PEM format") ("respect-umask", bpo::value(&Globals::globalConfig.bRespectUmask)->zero_tokens()->default_value(false), "Do not adjust permissions of sensitive files") ("user-agent", bpo::value(&Globals::globalConfig.curlConf.sUserAgent)->default_value(DEFAULT_USER_AGENT), "Set user agent") @@ -802,9 +801,7 @@ int main(int argc, char *argv[]) int res = 0; - if (Globals::globalConfig.bShowWishlist) - downloader.showWishlist(); - else if (Globals::globalConfig.bUpdateCache) + if (Globals::globalConfig.bUpdateCache) downloader.updateCache(); else if (Globals::globalConfig.bNotifications) downloader.checkNotifications(); diff --git a/man/lgogdownloader.1 b/man/lgogdownloader.1 index ca68e16..8ec23eb 100644 --- a/man/lgogdownloader.1 +++ b/man/lgogdownloader.1 @@ -48,6 +48,8 @@ Tags = t|tags Transformations = tr|transform|transformations .br User data = ud|userdata +.br +Wishlist = w|wishlist . .TP \fB\-\-download\fR @@ -158,9 +160,6 @@ The files are downloaded to directory specified with \fB\-\-directory\fR option. \fB\-o\fR [ \fB\-\-output\-file\fR ] arg Set filename of file downloaded with \fB\-\-download\-file\fR. .TP -\fB\-\-wishlist\fR -Show wishlist -.TP \fB\-\-cacert\fR arg Path to CA certificate bundle in PEM format .TP diff --git a/src/downloader.cpp b/src/downloader.cpp index 0e4bb46..eed33bd 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -579,6 +579,10 @@ int Downloader::listGames() } std::cout << userdata << std::endl; } + else if (Globals::globalConfig.iListFormat == GlobalConstants::LIST_FORMAT_WISHLIST) + { + this->showWishlist(); + } else { if (this->games.empty()) {