mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 15:28:11 -05:00
feat: add version command line arg to all executables
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
#include "UnlinkerArgs.h"
|
||||
|
||||
#include "GitVersion.h"
|
||||
#include "ObjLoading.h"
|
||||
#include "ObjWriting.h"
|
||||
#include "Utils/Arguments/UsageInformation.h"
|
||||
#include "Utils/FileUtils.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <regex>
|
||||
#include <type_traits>
|
||||
|
||||
@ -16,6 +18,12 @@ const CommandLineOption* const OPTION_HELP =
|
||||
.WithDescription("Displays usage information.")
|
||||
.Build();
|
||||
|
||||
const CommandLineOption* const OPTION_VERSION =
|
||||
CommandLineOption::Builder::Create()
|
||||
.WithLongName("version")
|
||||
.WithDescription("Prints the application version.")
|
||||
.Build();
|
||||
|
||||
const CommandLineOption* const OPTION_VERBOSE =
|
||||
CommandLineOption::Builder::Create()
|
||||
.WithShortName("v")
|
||||
@ -113,6 +121,7 @@ const CommandLineOption* const OPTION_LEGACY_MENUS =
|
||||
|
||||
const CommandLineOption* const COMMAND_LINE_OPTIONS[]{
|
||||
OPTION_HELP,
|
||||
OPTION_VERSION,
|
||||
OPTION_VERBOSE,
|
||||
OPTION_MINIMAL_ZONE_FILE,
|
||||
OPTION_LOAD,
|
||||
@ -155,6 +164,11 @@ void UnlinkerArgs::PrintUsage()
|
||||
usage.Print();
|
||||
}
|
||||
|
||||
void UnlinkerArgs::PrintVersion()
|
||||
{
|
||||
std::cout << "OpenAssetTools Unlinker " << std::string(GIT_VERSION) << "\n";
|
||||
}
|
||||
|
||||
void UnlinkerArgs::SetVerbose(const bool isVerbose)
|
||||
{
|
||||
m_verbose = isVerbose;
|
||||
@ -237,8 +251,9 @@ void UnlinkerArgs::ParseCommaSeparatedAssetTypeString(const std::string& input)
|
||||
AddSpecifiedAssetType(std::string(lowerInput, currentPos, lowerInput.size() - currentPos));
|
||||
}
|
||||
|
||||
bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
|
||||
bool UnlinkerArgs::ParseArgs(const int argc, const char** argv, bool& shouldContinue)
|
||||
{
|
||||
shouldContinue = true;
|
||||
if (!m_argument_parser.ParseArguments(argc - 1, &argv[1]))
|
||||
{
|
||||
PrintUsage();
|
||||
@ -252,6 +267,14 @@ bool UnlinkerArgs::ParseArgs(const int argc, const char** argv)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the user wants to see the version
|
||||
if (m_argument_parser.IsOptionSpecified(OPTION_VERSION))
|
||||
{
|
||||
PrintVersion();
|
||||
shouldContinue = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
m_zones_to_unlink = m_argument_parser.GetArguments();
|
||||
const size_t zoneCount = m_zones_to_unlink.size();
|
||||
if (zoneCount < 1)
|
||||
|
Reference in New Issue
Block a user