diff --git a/src/cli/extract.cpp b/src/cli/extract.cpp index ae72f21..52b802e 100644 --- a/src/cli/extract.cpp +++ b/src/cli/extract.cpp @@ -59,6 +59,7 @@ #include "setup/file.hpp" #include "setup/info.hpp" #include "setup/language.hpp" +#include "setup/component.hpp" #include "stream/chunk.hpp" #include "stream/file.hpp" @@ -628,7 +629,7 @@ bool print_file_info(const extract_options & o, const setup::info & info) { } #endif - bool multiple_sections = (o.list_languages + o.gog_game_id + o.list + o.show_password > 1); + bool multiple_sections = (o.list_languages + o.list_components + o.gog_game_id + o.list + o.show_password > 1); if(!o.quiet && multiple_sections) { std::cout << '\n'; } @@ -657,6 +658,26 @@ bool print_file_info(const extract_options & o, const setup::info & info) { std::cout << '\n'; } } + + if (o.list_components) { + if (multiple_sections) { + std::cout << "Components:\n"; + } + BOOST_FOREACH(const setup::component_entry & component, info.components) { + std::cout << " - " << color::green << component.name << color::reset; + if (!component.description.empty()) { + std::cout << ": " << color::white << component.description << color::reset; + } + std::cout << '\n'; + } + if (info.components.empty()) { + std::cout << " (none)\n"; + } + + if ((o.silent || !o.quiet) && multiple_sections) { + std::cout << '\n'; + } + } if(o.gog_game_id) { std::string id = gog::get_game_id(info); @@ -952,6 +973,9 @@ void process_file(const fs::path & installer, const extract_options & o) { if(o.list_languages) { entries |= setup::info::Languages; } + if(o.list_components) { + entries |= setup::info::Components; + } if(o.gog_game_id || o.gog) { entries |= setup::info::RegistryEntries; } @@ -992,7 +1016,7 @@ void process_file(const fs::path & installer, const extract_options & o) { throw format_error(oss.str()); } - if(o.gog_galaxy && (o.list || o.test || o.extract || o.list_languages)) { + if(o.gog_galaxy && (o.list || o.test || o.extract || o.list_languages || o.list_components)) { gog::parse_galaxy_files(info, o.gog); } diff --git a/src/cli/extract.hpp b/src/cli/extract.hpp index e6a84d6..e206e5c 100644 --- a/src/cli/extract.hpp +++ b/src/cli/extract.hpp @@ -64,6 +64,7 @@ struct extract_options { bool test; //!< Test files (but don't extract) bool extract; //!< Extract files bool list_languages; //!< List available languages + bool list_components; //!< List available components bool gog_game_id; //!< Show the GOG.com game id bool show_password; //!< Show password check information bool check_password; //!< Abort if the provided password is incorrect @@ -102,6 +103,7 @@ struct extract_options { , test(false) , extract(false) , list_languages(false) + , list_components(false) , gog_game_id(false) , show_password(false) , check_password(false) diff --git a/src/cli/main.cpp b/src/cli/main.cpp index 82b72d3..213b492 100644 --- a/src/cli/main.cpp +++ b/src/cli/main.cpp @@ -137,6 +137,7 @@ int main(int argc, char * argv[]) { ("list-checksums", "List file checksums") ("info,i", "Print information about the installer") ("list-languages", "List languages supported by the installer") + ("list-components", "List components supported by the installer") ("gog-game-id", "Determine the installer's GOG.com game ID") ("show-password", "Show password check information") ("check-password", "Abort if the password is incorrect") @@ -261,16 +262,19 @@ int main(int argc, char * argv[]) { o.extract = (options.count("extract") != 0); o.test = (options.count("test") != 0); o.list_languages = (options.count("list-languages") != 0); + o.list_components = (options.count("list-components") != 0); o.gog_game_id = (options.count("gog-game-id") != 0); o.show_password = (options.count("show-password") != 0); o.check_password = (options.count("check-password") != 0); if(options.count("info") != 0) { + o.list_components = true; o.list_languages = true; o.gog_game_id = true; o.show_password = true; } bool explicit_action = o.list || o.test || o.extract || o.list_languages - || o.gog_game_id || o.show_password || o.check_password; + || o.gog_game_id || o.show_password || o.check_password + || o.list_components; if(!explicit_action) { o.extract = true; }