Combine --list and --list-format options

Removes --list-format added in c9198d672da26fac0c567abcd6fac9e901ad38c8
--list is used to select the format instead
This commit is contained in:
Sude 2023-03-14 21:36:35 +02:00
parent 9e49b6fa20
commit 9d188e73bd
2 changed files with 9 additions and 5 deletions

View File

@ -239,7 +239,6 @@ class Config
bool bDownload; bool bDownload;
bool bRepair; bool bRepair;
bool bUpdated; bool bUpdated;
bool bList;
bool bCheckStatus; bool bCheckStatus;
bool bShowWishlist; bool bShowWishlist;
bool bNotifications; bool bNotifications;

View File

@ -162,7 +162,7 @@ int main(int argc, char *argv[])
include_options_text += "Separate with \",\" to use multiple values"; include_options_text += "Separate with \",\" to use multiple values";
// Create help text for --list-format option // Create help text for --list-format option
std::string list_format_text = "Select output format\n"; std::string list_format_text = "List games\nPossible output formats:\n";
for (unsigned int i = 0; i < GlobalConstants::LIST_FORMAT.size(); ++i) for (unsigned int i = 0; i < GlobalConstants::LIST_FORMAT.size(); ++i)
{ {
list_format_text += GlobalConstants::LIST_FORMAT[i].str + " = " + GlobalConstants::LIST_FORMAT[i].regexp + "\n"; list_format_text += GlobalConstants::LIST_FORMAT[i].str + " = " + GlobalConstants::LIST_FORMAT[i].regexp + "\n";
@ -190,6 +190,7 @@ int main(int argc, char *argv[])
bpo::options_description options_cfg_only; bpo::options_description options_cfg_only;
bpo::options_description options_cfg_all("Configuration"); bpo::options_description options_cfg_all("Configuration");
bool bClearUpdateNotifications = false; bool bClearUpdateNotifications = false;
bool bList = false;
try try
{ {
bool bInsecure = false; bool bInsecure = false;
@ -216,8 +217,7 @@ int main(int argc, char *argv[])
("help,h", "Print help message") ("help,h", "Print help message")
("version", "Print version information") ("version", "Print version information")
("login", bpo::value<bool>(&Globals::globalConfig.bLogin)->zero_tokens()->default_value(false), "Login") ("login", bpo::value<bool>(&Globals::globalConfig.bLogin)->zero_tokens()->default_value(false), "Login")
("list", bpo::value<bool>(&Globals::globalConfig.bList)->zero_tokens()->default_value(false), "List games") ("list", bpo::value<std::string>(&sListFormat)->implicit_value("no_details"), list_format_text.c_str())
("list-format", bpo::value<std::string>(&sListFormat)->default_value("no_details"), list_format_text.c_str())
("download", bpo::value<bool>(&Globals::globalConfig.bDownload)->zero_tokens()->default_value(false), "Download") ("download", bpo::value<bool>(&Globals::globalConfig.bDownload)->zero_tokens()->default_value(false), "Download")
("repair", bpo::value<bool>(&Globals::globalConfig.bRepair)->zero_tokens()->default_value(false), "Repair downloaded files\nUse --repair --download to redownload files when filesizes don't match (possibly different version). Redownload will rename the old file (appends .old to filename)") ("repair", bpo::value<bool>(&Globals::globalConfig.bRepair)->zero_tokens()->default_value(false), "Repair downloaded files\nUse --repair --download to redownload files when filesizes don't match (possibly different version). Redownload will rename the old file (appends .old to filename)")
("game", bpo::value<std::string>(&Globals::globalConfig.sGameRegex)->default_value(""), "Set regular expression filter\nfor download/list/repair (Perl syntax)") ("game", bpo::value<std::string>(&Globals::globalConfig.sGameRegex)->default_value(""), "Set regular expression filter\nfor download/list/repair (Perl syntax)")
@ -337,6 +337,11 @@ int main(int argc, char *argv[])
return 0; return 0;
} }
if (vm.count("list"))
{
bList = true;
}
// Create lgogdownloader directories // Create lgogdownloader directories
boost::filesystem::path path = Globals::globalConfig.sXMLDirectory; boost::filesystem::path path = Globals::globalConfig.sXMLDirectory;
if (!boost::filesystem::exists(path)) if (!boost::filesystem::exists(path))
@ -790,7 +795,7 @@ int main(int argc, char *argv[])
downloader.repair(); downloader.repair();
else if (Globals::globalConfig.bDownload) // Download games else if (Globals::globalConfig.bDownload) // Download games
downloader.download(); downloader.download();
else if (Globals::globalConfig.bList) // List games/extras else if (bList) // List games/extras
res = downloader.listGames(); res = downloader.listGames();
else if (Globals::globalConfig.bListTags) // List tags else if (Globals::globalConfig.bListTags) // List tags
res = downloader.listTags(); res = downloader.listTags();