Error: Invalid configuration key | |||||
################################ | |||||
``dds`` uses a very simple key-value-pair plaintext configuration file format. | |||||
Receiving this error indicates that one of the keys in a configuration file is | |||||
invalid. |
#include "./deps.hpp" | #include "./deps.hpp" | ||||
#include <dds/dym.hpp> | |||||
#include <dds/error/errors.hpp> | #include <dds/error/errors.hpp> | ||||
#include <dds/repo/repo.hpp> | #include <dds/repo/repo.hpp> | ||||
#include <dds/source/dist.hpp> | #include <dds/source/dist.hpp> | ||||
} | } | ||||
return false; | return false; | ||||
}, | }, | ||||
lm::reject_unknown()); | |||||
lm_reject_dym{{"Depends"}}); | |||||
return ret; | return ret; | ||||
} | } | ||||
#include <dds/dym.hpp> | #include <dds/dym.hpp> | ||||
#include <dds/error/errors.hpp> | |||||
#include <range/v3/algorithm/min_element.hpp> | #include <range/v3/algorithm/min_element.hpp> | ||||
#include <range/v3/view/cartesian_product.hpp> | #include <range/v3/view/cartesian_product.hpp> | ||||
#include <range/v3/view/iota.hpp> | #include <range/v3/view/iota.hpp> | ||||
return matrix.back().back(); | return matrix.back().back(); | ||||
} | } | ||||
bool lm_reject_dym::operator()(std::string_view context, | |||||
std::string_view key, | |||||
std::string_view) const { | |||||
assert(candidates.size() > 0); | |||||
throw_user_error<errc::invalid_config_key>("{}: Unknown key '{}' (Did you meann '{}'?)", | |||||
context, | |||||
key, | |||||
*did_you_mean(key, candidates)); | |||||
} |
return did_you_mean(given, ranges::views::all(strings)); | return did_you_mean(given, ranges::views::all(strings)); | ||||
} | } | ||||
struct lm_reject_dym { | |||||
std::initializer_list<std::string_view> candidates; | |||||
[[noreturn]] bool | |||||
operator()(std::string_view context, std::string_view key, std::string_view value) const; | |||||
}; | |||||
} // namespace dds | } // namespace dds |
return "invalid-version-string.html#range"; | return "invalid-version-string.html#range"; | ||||
case errc::invalid_version_string: | case errc::invalid_version_string: | ||||
return "invalid-version-string.html"; | return "invalid-version-string.html"; | ||||
case errc::invalid_config_key: | |||||
return "invalid-config-key.html"; | |||||
case errc::none: | case errc::none: | ||||
break; | break; | ||||
} | } | ||||
specification. Refer to the documentation and https://semver.org/ for more | specification. Refer to the documentation and https://semver.org/ for more | ||||
information. | information. | ||||
)"; | )"; | ||||
case errc::invalid_config_key: | |||||
return R"(The `key' in a `key: value' pair was not recognized.)"; | |||||
case errc::none: | case errc::none: | ||||
break; | break; | ||||
} | } | ||||
case errc::invalid_version_string: | case errc::invalid_version_string: | ||||
return "Attempted to parse an invalid version string. <- (Seeing this text is a `dds` bug. " | return "Attempted to parse an invalid version string. <- (Seeing this text is a `dds` bug. " | ||||
"Please report it.)"; | "Please report it.)"; | ||||
case errc::invalid_config_key: | |||||
return "Found an invalid configuration key. <- (Seeing this text is a `dds` bug. Please " | |||||
"report it.)"; | |||||
case errc::none: | case errc::none: | ||||
break; | break; | ||||
} | } |
invalid_version_range_string, | invalid_version_range_string, | ||||
invalid_version_string, | invalid_version_string, | ||||
invalid_config_key, | |||||
}; | }; | ||||
std::string error_reference_of(errc) noexcept; | std::string error_reference_of(errc) noexcept; |
#include "./manifest.hpp" | #include "./manifest.hpp" | ||||
#include <dds/dym.hpp> | |||||
#include <dds/util/algo.hpp> | #include <dds/util/algo.hpp> | ||||
#include <range/v3/view/transform.hpp> | #include <range/v3/view/transform.hpp> | ||||
lm::read_accumulate("Uses", uses_strings), | lm::read_accumulate("Uses", uses_strings), | ||||
lm::read_accumulate("Links", links_strings), | lm::read_accumulate("Links", links_strings), | ||||
lm::read_required("Name", ret.name), | lm::read_required("Name", ret.name), | ||||
lm::ignore_x_keys(), | |||||
lm::reject_unknown()); | |||||
lm_reject_dym{{"Uses", "Links", "Name"}}); | |||||
extend(ret.uses, ranges::views::transform(uses_strings, lm::split_usage_string)); | extend(ret.uses, ranges::views::transform(uses_strings, lm::split_usage_string)); | ||||
extend(ret.links, ranges::views::transform(links_strings, lm::split_usage_string)); | extend(ret.links, ranges::views::transform(links_strings, lm::split_usage_string)); |
#include "./manifest.hpp" | #include "./manifest.hpp" | ||||
#include <dds/dym.hpp> | |||||
#include <dds/util/string.hpp> | #include <dds/util/string.hpp> | ||||
#include <libman/parse.hpp> | #include <libman/parse.hpp> | ||||
lm::read_required("Version", version_str), | lm::read_required("Version", version_str), | ||||
lm::read_accumulate("Depends", depends_strs), | lm::read_accumulate("Depends", depends_strs), | ||||
lm::read_opt("Test-Driver", opt_test_driver), | lm::read_opt("Test-Driver", opt_test_driver), | ||||
lm::reject_unknown()); | |||||
lm_reject_dym{{"Name", "Namespace", "Version", "Depends", "Test-Driver"}}); | |||||
if (ret.pkg_id.name.empty()) { | if (ret.pkg_id.name.empty()) { | ||||
throw std::runtime_error( | throw std::runtime_error( |
#include "./from_dds.hpp" | #include "./from_dds.hpp" | ||||
#include <dds/dym.hpp> | |||||
#include <dds/toolchain/prep.hpp> | #include <dds/toolchain/prep.hpp> | ||||
#include <dds/toolchain/toolchain.hpp> | #include <dds/toolchain/toolchain.hpp> | ||||
#include <dds/util/algo.hpp> | #include <dds/util/algo.hpp> | ||||
lm::read_opt("Executable-Prefix", exe_prefix), | lm::read_opt("Executable-Prefix", exe_prefix), | ||||
lm::read_opt("Executable-Suffix", exe_suffix), | lm::read_opt("Executable-Suffix", exe_suffix), | ||||
// Die: | // Die: | ||||
lm::reject_unknown()); | |||||
lm_reject_dym{{ | |||||
"Compiler-ID", | |||||
"C-Compiler", | |||||
"C++-Compiler", | |||||
"C-Version", | |||||
"C++-Version", | |||||
"Include-Template", | |||||
"External-Include-Template", | |||||
"Define-Template", | |||||
"Warning-Flags", | |||||
"Flags", | |||||
"C-Flags", | |||||
"C++-Flags", | |||||
"Link-Flags", | |||||
"Optimize", | |||||
"Debug", | |||||
"Compiler-Launcher", | |||||
"Deps-Mode", | |||||
"C-Compile-File", | |||||
"C++-Compile-File", | |||||
"Create-Archive", | |||||
"Link-Executable", | |||||
"Archive-Prefix", | |||||
"Archive-Suffix", | |||||
"Object-Prefix", | |||||
"Object-Suffix", | |||||
"Executable-Prefix", | |||||
"Executable-Suffix", | |||||
}}); | |||||
toolchain_prep tc; | toolchain_prep tc; | ||||