21 #include <boost/program_options.hpp>
42 namespace po = boost::program_options;
45 po::options_description options { };
47 (
"host", po::value<string>(),
48 "Hosting solution: iRODS or WebDAV (case insensitive)")
49 (
"host-url", po::value<string>()->default_value(
""),
51 (
"user", po::value<string>()->default_value(
""),
52 "User name if needed")
53 (
"password", po::value<string>()->default_value(
""),
55 (
"overwrite", po::value<string>()->default_value(
"no"),
56 "Allow overwriting local files if they already exist")
57 (
"distant-workspace", po::value<string>(),
58 "Path to distant repository workspace")
59 (
"local-workspace", po::value<string>(),
60 "Path to local repository workspace")
61 (
"tries", po::value<int>()->default_value(4),
62 "Number of download tries");
70 po::store(po::parse_config_file<char>(abs_path.c_str(), options), vm);
78 hostUrl = vm[
"host-url"].as<
string>();
79 user = vm[
"user"].as<
string>();
80 password = vm[
"password"].as<
string>();
84 tries =
static_cast<size_t>(vm[
"tries"].as<
int>());
89 const string uncased =
lower(name);
90 if (uncased ==
"irods") {
92 }
else if (uncased ==
"webdav") {
103 const vector<string> overwriteAllowedOptions = {
"true",
"yes",
"y" };
104 const vector<string> overwriteForbiddenOptions = {
"false",
"no",
"n" };
106 string uncased =
lower(policy);
109 }
else if (
valueIsListed(uncased, overwriteForbiddenOptions)) {
void parseConfigurationFile(const path &filename)
ConnectionConfiguration(const path &configFile)
Create a dependency configuration by reading a configuration file.
void parseOverwritingPolicy(const std::string &policy)
void parseHost(const std::string &name)
bool overwritingAllowed() const
Check whether existing local files can be overwritten.
OverwritingPolicy overwritingPolicy
Exception raised when a hosting solution is not supported by the tool.
Elements::Path::Item path
ELEMENTS_API std::string lower(std::string text)
ELEMENTS_API path confFilePath(path filename)
ELEMENTS_API bool valueIsListed(const T &value, const std::vector< T > &list)
ELEMENTS_API path localWorkspacePrefix()
constexpr double e
The base of the natural logarithm .