forked from lix-project/lix
Fix tests on systems with a non-master git defaultBranch #1
2 changed files with 29 additions and 0 deletions
|
@ -7,6 +7,32 @@
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
void to_json(nlohmann::json & j, const AcceptFlakeConfig & e)
|
||||||
|
{
|
||||||
|
if (e == AcceptFlakeConfig::False) {
|
||||||
|
j = false;
|
||||||
|
} else if (e == AcceptFlakeConfig::Ask) {
|
||||||
|
j = "ask";
|
||||||
|
} else if (e == AcceptFlakeConfig::True) {
|
||||||
|
j = true;
|
||||||
|
} else {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void from_json(const nlohmann::json & j, AcceptFlakeConfig & e)
|
||||||
|
{
|
||||||
|
if (j == false) {
|
||||||
|
e = AcceptFlakeConfig::False;
|
||||||
|
} else if (j == "ask") {
|
||||||
|
e = AcceptFlakeConfig::Ask;
|
||||||
|
} else if (j == true) {
|
||||||
|
e = AcceptFlakeConfig::True;
|
||||||
|
} else {
|
||||||
|
throw Error("Invalid accept-flake-config value '%s'", std::string(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<> AcceptFlakeConfig BaseSetting<AcceptFlakeConfig>::parse(const std::string & str, const ApplyConfigOptions & options) const
|
template<> AcceptFlakeConfig BaseSetting<AcceptFlakeConfig>::parse(const std::string & str, const ApplyConfigOptions & options) const
|
||||||
{
|
{
|
||||||
if (str == "true") return AcceptFlakeConfig::True;
|
if (str == "true") return AcceptFlakeConfig::True;
|
||||||
|
|
|
@ -13,6 +13,9 @@ namespace nix {
|
||||||
|
|
||||||
enum class AcceptFlakeConfig { False, Ask, True };
|
enum class AcceptFlakeConfig { False, Ask, True };
|
||||||
|
|
||||||
|
void to_json(nlohmann::json & j, const AcceptFlakeConfig & e);
|
||||||
|
void from_json(const nlohmann::json & j, AcceptFlakeConfig & e);
|
||||||
|
|
||||||
struct FetchSettings : public Config
|
struct FetchSettings : public Config
|
||||||
{
|
{
|
||||||
FetchSettings();
|
FetchSettings();
|
||||||
|
|
Loading…
Reference in a new issue