feat: Added separate --version-short command
This commit is contained in:
parent
ed6da7fe14
commit
e63606f6bb
@ -6,6 +6,7 @@
|
||||
namespace hex::plugin::builtin {
|
||||
|
||||
void handleVersionCommand(const std::vector<std::string> &args);
|
||||
void handleVersionShortCommand(const std::vector<std::string> &args);
|
||||
void handleHelpCommand(const std::vector<std::string> &args);
|
||||
void handlePluginsCommand(const std::vector<std::string> &args);
|
||||
void handleLanguageCommand(const std::vector<std::string> &args);
|
||||
|
@ -30,18 +30,20 @@ namespace hex::plugin::builtin {
|
||||
using namespace hex::literals;
|
||||
|
||||
void handleVersionCommand(const std::vector<std::string> &args) {
|
||||
if (args.empty()) {
|
||||
hex::log::print(std::string(romfs::get("logo.ans").string()),
|
||||
ImHexApi::System::getImHexVersion().get(),
|
||||
ImHexApi::System::getCommitBranch(), ImHexApi::System::getCommitHash(),
|
||||
__DATE__, __TIME__,
|
||||
ImHexApi::System::isPortableVersion() ? "Portable" : "Installed");
|
||||
} else if (args.size() == 1 && args[0] == "plain") {
|
||||
hex::log::print("{}", ImHexApi::System::getImHexVersion().get());
|
||||
} else {
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
std::ignore = args;
|
||||
|
||||
hex::log::print(std::string(romfs::get("logo.ans").string()),
|
||||
ImHexApi::System::getImHexVersion().get(),
|
||||
ImHexApi::System::getCommitBranch(), ImHexApi::System::getCommitHash(),
|
||||
__DATE__, __TIME__,
|
||||
ImHexApi::System::isPortableVersion() ? "Portable" : "Installed");
|
||||
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
void handleVersionShortCommand(const std::vector<std::string> &args) {
|
||||
std::ignore = args;
|
||||
hex::log::println("{}", ImHexApi::System::getImHexVersion().get());
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ namespace hex::plugin::builtin {
|
||||
IMHEX_PLUGIN_SUBCOMMANDS() {
|
||||
{ "help", "h", "Print help about this command", hex::plugin::builtin::handleHelpCommand },
|
||||
{ "version", "", "Print ImHex version", hex::plugin::builtin::handleVersionCommand },
|
||||
{ "version-short", "", "Print only the version info in plain text", hex::plugin::builtin::handleVersionShortCommand },
|
||||
{ "plugins", "", "Lists all plugins that have been installed", hex::plugin::builtin::handlePluginsCommand },
|
||||
{ "language", "", "Changes the language ImHex uses", hex::plugin::builtin::handleLanguageCommand },
|
||||
{ "verbose", "v", "Enables verbose debug logging", hex::plugin::builtin::handleVerboseCommand },
|
||||
|
Loading…
x
Reference in New Issue
Block a user