diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..3b78506 --- /dev/null +++ b/src/version.h @@ -0,0 +1 @@ +#define WIREGUARD_TOOLS_VERSION "0.0.20191219" diff --git a/src/wg.c b/src/wg.c index 7b5d3af..dc6dda4 100644 --- a/src/wg.c +++ b/src/wg.c @@ -8,6 +8,7 @@ #include #include "subcommands.h" +#include "version.h" const char *PROG_NAME; @@ -40,6 +41,10 @@ int main(int argc, char *argv[]) { PROG_NAME = argv[0]; + if (argc == 2 && (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version") || !strcmp(argv[1], "version"))) { + printf("wireguard-tools v%s - https://git.zx2c4.com/wireguard-tools/\n", WIREGUARD_TOOLS_VERSION); + return 0; + } if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help") || !strcmp(argv[1], "help"))) { show_usage(stdout); return 0;