diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-09-11 15:50:04 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-09-13 16:14:43 +0200 |
commit | 795e3e8ce01611a3448a23ca634b2271dfc2e5c6 (patch) | |
tree | a615661cbf60c93ae992a21e679bdad3fdfa9dd1 /src/buildtool/common/cli.hpp | |
parent | 2ca5f6b03fbae4bfe9edd62f04c4a88d273c2ac8 (diff) | |
download | justbuild-795e3e8ce01611a3448a23ca634b2271dfc2e5c6.tar.gz |
just: Add handling of 'just serve' configuration
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r-- | src/buildtool/common/cli.hpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index a49b2f6b..c90e54f9 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -150,7 +150,7 @@ struct ServerAuthArguments { std::optional<std::filesystem::path> tls_server_key{std::nullopt}; }; -struct ExecutionServiceArguments { +struct ServiceArguments { std::optional<int> port{std::nullopt}; std::optional<std::filesystem::path> info_file{std::nullopt}; std::optional<std::string> interface{std::nullopt}; @@ -158,6 +158,12 @@ struct ExecutionServiceArguments { std::optional<uint8_t> op_exponent; }; +struct ServeArguments { + std::filesystem::path config{}; + // repositories populated from just-serve config file + std::vector<std::filesystem::path> repositories{}; +}; + static inline auto SetupCommonArguments( gsl::not_null<CLI::App*> const& app, gsl::not_null<CommonArguments*> const& clargs) { @@ -601,33 +607,43 @@ static inline auto SetupServerAuthArguments( "Path to the TLS server key."); } -static inline auto SetupExecutionServiceArguments( +static inline auto SetupServiceArguments( gsl::not_null<CLI::App*> const& app, - gsl::not_null<ExecutionServiceArguments*> const& es_args) { + gsl::not_null<ServiceArguments*> const& service_args) { app->add_option("-p,--port", - es_args->port, - "Execution service will listen to this port. If unset, the " + service_args->port, + "The service will listen to this port. If unset, the " "service will listen to the first available one."); app->add_option("--info-file", - es_args->info_file, + service_args->info_file, "Write the used port, interface, and pid to this file in " "JSON format. If the file exists, it " "will be overwritten."); app->add_option("-i,--interface", - es_args->interface, + service_args->interface, "Interface to use. If unset, the loopback device is used."); app->add_option( "--pid-file", - es_args->pid_file, + service_args->pid_file, "Write pid to this file in plain txt. If the file exists, it " "will be overwritten."); app->add_option( "--log-operations-threshold", - es_args->op_exponent, + service_args->op_exponent, "Once the number of operations stored exceeds twice 2^n, where n is " "given by the option --log-operations-threshold, at most 2^n " "operations will be removed, in a FIFO scheme. If unset, defaults to " "14. Must be in the range [0,255]"); } + +static inline auto SetupServeArguments( + gsl::not_null<CLI::App*> const& app, + gsl::not_null<ServeArguments*> const& serve_args) { + app->add_option("config", + serve_args->config, + "Configuration file for the subcommand.") + ->required(); +} + #endif // INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP |