Added command for printing version information.
This commit is contained in:
parent
974c94fbb0
commit
cde892c771
23
app/include/plasp-app/commands/CommandVersion.h
Normal file
23
app/include/plasp-app/commands/CommandVersion.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef __PLASP_APP__COMMANDS__COMMAND_VERSION_H
|
||||||
|
#define __PLASP_APP__COMMANDS__COMMAND_VERSION_H
|
||||||
|
|
||||||
|
#include <plasp-app/Command.h>
|
||||||
|
#include <plasp-app/OptionGroups.h>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Command Version
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class CommandVersion : public Command<>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CommandVersion();
|
||||||
|
|
||||||
|
int run(int argc, char **argv);
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#endif
|
21
app/src/plasp-app/commands/CommandVersion.cpp
Normal file
21
app/src/plasp-app/commands/CommandVersion.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include <plasp-app/commands/CommandVersion.h>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Command Version
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
CommandVersion::CommandVersion()
|
||||||
|
: Command(cxxopts::Options("plasp version", "Display version information."))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int CommandVersion::run(int, char **)
|
||||||
|
{
|
||||||
|
printVersion();
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
@ -10,6 +10,7 @@
|
|||||||
#include <plasp-app/Command.h>
|
#include <plasp-app/Command.h>
|
||||||
#include <plasp-app/Version.h>
|
#include <plasp-app/Version.h>
|
||||||
#include <plasp-app/commands/CommandTranslate.h>
|
#include <plasp-app/commands/CommandTranslate.h>
|
||||||
|
#include <plasp-app/commands/CommandVersion.h>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@ -71,12 +72,6 @@ int main(int argc, char **argv)
|
|||||||
<< "Usage: plasp <command> [<arguments>]" << std::endl;
|
<< "Usage: plasp <command> [<arguments>]" << std::endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto printVersion =
|
|
||||||
[&]()
|
|
||||||
{
|
|
||||||
std::cout << Version << std::endl;
|
|
||||||
};
|
|
||||||
|
|
||||||
colorlog::Logger logger;
|
colorlog::Logger logger;
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
@ -93,7 +88,7 @@ int main(int argc, char **argv)
|
|||||||
printHelp();
|
printHelp();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
case CommandType::Version:
|
case CommandType::Version:
|
||||||
printVersion();
|
return CommandVersion().run(argc - 1, &argv[1]);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
case CommandType::Translate:
|
case CommandType::Translate:
|
||||||
return CommandTranslate().run(argc - 1, &argv[1]);
|
return CommandTranslate().run(argc - 1, &argv[1]);
|
||||||
|
Reference in New Issue
Block a user