aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 605e1dc..5f7426d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,6 +17,10 @@ static const struct Command main_commands[] = {
{ .name = "env", .func = main_env, .description = "show some information about polecat" },
};
+static const struct Flag main_flags[] = {
+ { .name = "help", .variant = DOUBLE, .func = main_help, .description = "show this message"},
+ { .name = "version", .variant = BOTH, .func = main_version, .description = "prints the program version"}
+};
COMMAND_GROUP_FUNC(main)
@@ -25,10 +29,7 @@ COMMAND(main, env)
char buffer[PATH_MAX];
- printf("version:\t\t%s\n"
- "user-Agent:\t\t%s\n",
- VERSION,
- USER_AGENT);
+ printf("user-Agent:\t\t%s\n", USER_AGENT);
getConfigDir(buffer, sizeof(buffer));
printf("config dir\t\t%s\n", buffer);
@@ -40,4 +41,11 @@ COMMAND(main, env)
return 0;
}
+COMMAND(main, version)
+{
+ puts(VERSION);
+
+ return 0;
+}
+
COMMAND_HELP(main, "")