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