add option to print webfuse version

pull/105/head
Falk Werner 1 year ago
parent b3bc3144bf
commit 1cbdfac3cc

@ -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- 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-auth-header | name | - | Optional. Specify the name of the HTTP header used for authentication |
| --wf-timeout | timeout | 10 | Optional. Specify the communication timeout. | | --wf-timeout | timeout | 10 | Optional. Specify the communication timeout. |
| --wf-version | - | - | Print version and exit. |
## Fuse options ## Fuse options

@ -2,6 +2,7 @@
#include "webfuse/fuse.hpp" #include "webfuse/fuse.hpp"
#include "webfuse/filesystem.hpp" #include "webfuse/filesystem.hpp"
#include "webfuse/ws/server.hpp" #include "webfuse/ws/server.hpp"
#include "webfuse/version.hpp"
#include <iostream> #include <iostream>
@ -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()); config.exit_code = fuse_fs.run(config.args.get_argc(), config.args.get_argv());
} }
break; break;
case command::print_version:
std::cout << webfuse::get_version() << std::endl;
break;
case command::show_help: case command::show_help:
// fall-through // fall-through
default: default:
@ -37,6 +41,7 @@ WEBFUSE options:
--wf-authenticator PATH path of authenticatior app (optional) --wf-authenticator PATH path of authenticatior app (optional)
--wf-auth-header NAME name of the authentication header (optional) --wf-auth-header NAME name of the authentication header (optional)
--wf-timeout TIMEOUT communication timeout in seconds (default: 10) --wf-timeout TIMEOUT communication timeout in seconds (default: 10)
--wf-version print version and exit
)"; )";
} }
break; break;

@ -112,6 +112,10 @@ ws_config::ws_config(int argc, char * argv[])
timeout_secs = static_cast<uint64_t>(std::stoi(timeout_str)); timeout_secs = static_cast<uint64_t>(std::stoi(timeout_str));
} }
} }
else if (arg == "--wf-version")
{
cmd = command::print_version;
}
else else
{ {
args.push(arg.c_str()); args.push(arg.c_str());

@ -12,6 +12,7 @@ namespace webfuse
enum class command enum class command
{ {
run, run,
print_version,
show_help show_help
}; };

Loading…
Cancel
Save