diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-18 12:58:05 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-20 13:20:04 +0100 |
commit | 64f5d884e4592b2e6f872db3d8a020ab2d6f8416 (patch) | |
tree | aee18f2d1c74639171b3fad068890336ef39966b /src/buildtool/common/cli.hpp | |
parent | 9f07b2e98e9e8bfa8aeef2a4b292cd0e3bc57424 (diff) | |
download | justbuild-64f5d884e4592b2e6f872db3d8a020ab2d6f8416.tar.gz |
Add new subcommand add-to-cas
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r-- | src/buildtool/common/cli.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 7b4f3987..6b6be63a 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -607,6 +607,34 @@ static inline auto SetupFetchArguments( "--remember", clargs->remember, "Copy object to local CAS first"); } +static inline auto SetupToAddArguments( + gsl::not_null<CLI::App*> const& app, + gsl::not_null<ToAddArguments*> const& clargs) { + app->add_option_function<std::string>( + "location", + [clargs](auto const& path_raw) { + std::filesystem::path in = ToNormalPath(path_raw); + if (not in.is_absolute()) { + try { + in = std::filesystem::absolute(in); + } catch (std::exception const& e) { + Logger::Log(LogLevel::Error, + "Failed to convert input path {} ({})", + path_raw, + e.what()); + throw e; + } + } + clargs->location = in; + }, + "The path on the local file system to be added to CAS") + ->required(); + app->add_flag("--follow-symlinks", + clargs->follow_symlinks, + "Resolve the positional argument to not be a symbolic link " + "before adding it to CAS."); +} + static inline auto SetupGraphArguments( gsl::not_null<CLI::App*> const& app, gsl::not_null<GraphArguments*> const& clargs) { |