diff --git a/doc/webfuse.md b/doc/webfuse.md index cc5f72e..adc749c 100644 --- a/doc/webfuse.md +++ b/doc/webfuse.md @@ -18,6 +18,7 @@ filesystem via fuse and exposes it's API via websockets. | --wf- authenticator | path | - | Optional. Specify the file path of the authenticator executable | | --wf-auth-header | name | - | Optional. Specify the name of the HTTP header used for authentication | | --wf-timeout | timeout | 10 | Optional. Specify the communication timeout. | +| --wf-version | - | - | Print version and exit. | ## Fuse options diff --git a/src/webfuse/webfuse.cpp b/src/webfuse/webfuse.cpp index 37916e0..2a9df2a 100644 --- a/src/webfuse/webfuse.cpp +++ b/src/webfuse/webfuse.cpp @@ -2,6 +2,7 @@ #include "webfuse/fuse.hpp" #include "webfuse/filesystem.hpp" #include "webfuse/ws/server.hpp" +#include "webfuse/version.hpp" #include @@ -23,6 +24,9 @@ int app::run(int argc, char * argv[]) // NOLINT(readability-convert-member-funct config.exit_code = fuse_fs.run(config.args.get_argc(), config.args.get_argv()); } break; + case command::print_version: + std::cout << webfuse::get_version() << std::endl; + break; case command::show_help: // fall-through default: @@ -37,6 +41,7 @@ WEBFUSE options: --wf-authenticator PATH path of authenticatior app (optional) --wf-auth-header NAME name of the authentication header (optional) --wf-timeout TIMEOUT communication timeout in seconds (default: 10) + --wf-version print version and exit )"; } break; diff --git a/src/webfuse/ws/config.cpp b/src/webfuse/ws/config.cpp index e8f0120..f280ed8 100644 --- a/src/webfuse/ws/config.cpp +++ b/src/webfuse/ws/config.cpp @@ -112,6 +112,10 @@ ws_config::ws_config(int argc, char * argv[]) timeout_secs = static_cast(std::stoi(timeout_str)); } } + else if (arg == "--wf-version") + { + cmd = command::print_version; + } else { args.push(arg.c_str()); diff --git a/src/webfuse/ws/config.hpp b/src/webfuse/ws/config.hpp index 53b2616..a1183bb 100644 --- a/src/webfuse/ws/config.hpp +++ b/src/webfuse/ws/config.hpp @@ -12,6 +12,7 @@ namespace webfuse enum class command { run, + print_version, show_help };