fix: versioning
This commit is contained in:
parent
4d28033073
commit
486b45c680
3 changed files with 18 additions and 7 deletions
src/helpers
|
@ -6,6 +6,7 @@
|
|||
#include <config.h>
|
||||
#include <logger.h>
|
||||
#include <helpers.h>
|
||||
#include <version.h>
|
||||
|
||||
static const char *const usage[] = {
|
||||
"core [options] [[--] args]",
|
||||
|
@ -16,12 +17,13 @@ static const char *const usage[] = {
|
|||
void
|
||||
helper_parse_cli(int argc, const char **argv, config_t *config)
|
||||
{
|
||||
int version = 0;
|
||||
struct argparse_option options[] =
|
||||
{
|
||||
OPT_HELP(),
|
||||
OPT_GROUP("Basic options"),
|
||||
OPT_STRING('c', "config", &config->file, "path to config file", NULL, 0, OPT_NONEG),
|
||||
|
||||
OPT_BOOLEAN('v', "version", &version, "print version", NULL, 0, OPT_NONEG),
|
||||
OPT_END(),
|
||||
};
|
||||
|
||||
|
@ -34,6 +36,12 @@ helper_parse_cli(int argc, const char **argv, config_t *config)
|
|||
);
|
||||
argc = argparse_parse(&argparse, argc, argv);
|
||||
|
||||
if(version)
|
||||
{
|
||||
printf("%s\n", EMGAUWA_CORE_VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if(argc == 1)
|
||||
{
|
||||
config->run_type = RUN_TYPE_INVALID;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue