diff options
-rw-r--r-- | share/man/just-mrrc.5.org | 7 | ||||
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 4 | ||||
-rw-r--r-- | src/other_tools/just_mr/main.cpp | 29 |
3 files changed, 37 insertions, 3 deletions
diff --git a/share/man/just-mrrc.5.org b/share/man/just-mrrc.5.org index b3c56cee..05166cd2 100644 --- a/share/man/just-mrrc.5.org +++ b/share/man/just-mrrc.5.org @@ -62,6 +62,12 @@ The just-mrrc is given by a JSON object. path to the ~just~ binary to use for execution, if ~just-mr~ is used as a launcher. +- The value for the key ~"local launcher"~, if given, is list of + strings setting the default for local launcher for ~just-mr~; + command-line arguments take precedence over the value in the + configuration file. If the key ~"local launcher"~ is absent, the + default ~["env", "--"]~ is assumed. + - The value for the key ~"just args"~ is a JSON object. Its keys are ~just~ subcommands and its value is a JSON list of strings. For the corresponding subcommand, these strings are prefixed to the ~just~ argument vector, if @@ -80,6 +86,7 @@ An example just-mrrc file could look like the following: ] , "local build root": {"root": "home", "path": ".cache/just"} , "checkout locations": {"root": "home", "path": ".just-local.json"} +, "local launcher": ["env", "--"] , "distdirs": [{"root": "home", "path": ".distfiles"}] , "just": {"root": "system", "path": "usr/bin/just"} , "just args": diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 01622980..8b5604a6 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -109,9 +109,7 @@ static inline void SetupMultiRepoCommonArguments( }, "JSON array with the list of strings representing the launcher to " "prepend actions' commands before being executed locally.") - ->type_name("JSON") - ->run_callback_for_default() - ->default_val(nlohmann::json(kDefaultLauncher).dump()); + ->type_name("JSON"); app->add_option_function<std::string>( "--distdir", [clargs](auto const& distdir_raw) { diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 965c3bf0..0657c84c 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -387,6 +387,35 @@ void SetupLogging(MultiRepoLogArguments const& clargs) { clargs->just_cmd.just_args[cmd_name] = std::move(args); } } + // read default for local launcher + if (not clargs->common.local_launcher) { + auto launcher = rc_config["local launcher"]; + if (launcher.IsNotNull()) { + if (not launcher->IsList()) { + Logger::Log(LogLevel::Error, + "Configuration-file provided launcher {} is not a " + "list of strings", + launcher->ToString()); + std::exit(kExitConfigError); + } + std::vector<std::string> default_launcher{}; + default_launcher.reserve(launcher->List().size()); + for (auto const& entry : launcher->List()) { + if (not entry->IsString()) { + Logger::Log(LogLevel::Error, + "Configuration-file provided launcher {} is " + "not a list of strings", + launcher->ToString()); + std::exit(kExitConfigError); + } + default_launcher.emplace_back(entry->String()); + } + clargs->common.local_launcher = default_launcher; + } + else { + clargs->common.local_launcher = kDefaultLauncher; + } + } // read config lookup order auto config_lookup_order = rc_config["config lookup order"]; if (config_lookup_order.IsNotNull()) { |