diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-11 02:00:44 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-11 18:55:29 -0500 |
commit | a7c0cff07f3e1af60bdbcd5bf7e13f8ae768da90 (patch) | |
tree | 3c4d82ec51acbf3d9ba3923f10e5526aa7f491ee /src/libstore/outputs-spec.cc | |
parent | a8f45b5e5a42daa9bdee640255464d4dbb431352 (diff) |
Rename `OutputPath` -> `ExtendedOutputPath`
Do this prior to making a new more limitted `OutputPath` we will use in
more places.
Diffstat (limited to 'src/libstore/outputs-spec.cc')
-rw-r--r-- | src/libstore/outputs-spec.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/libstore/outputs-spec.cc b/src/libstore/outputs-spec.cc index b5ea7e325..c446976bc 100644 --- a/src/libstore/outputs-spec.cc +++ b/src/libstore/outputs-spec.cc @@ -6,7 +6,7 @@ namespace nix { -std::pair<std::string, OutputsSpec> OutputsSpec::parse(std::string s) +std::pair<std::string, ExtendedOutputsSpec> ExtendedOutputsSpec::parse(std::string s) { static std::regex regex(R"((.*)\^((\*)|([a-z]+(,[a-z]+)*)))"); @@ -20,43 +20,43 @@ std::pair<std::string, OutputsSpec> OutputsSpec::parse(std::string s) return {match[1], tokenizeString<OutputNames>(match[4].str(), ",")}; } -std::string OutputsSpec::to_string() const +std::string ExtendedOutputsSpec::to_string() const { return std::visit(overloaded { - [&](const OutputsSpec::Default &) -> std::string { + [&](const ExtendedOutputsSpec::Default &) -> std::string { return ""; }, - [&](const OutputsSpec::All &) -> std::string { + [&](const ExtendedOutputsSpec::All &) -> std::string { return "*"; }, - [&](const OutputsSpec::Names & outputNames) -> std::string { + [&](const ExtendedOutputsSpec::Names & outputNames) -> std::string { return "^" + concatStringsSep(",", outputNames); }, }, raw()); } -void to_json(nlohmann::json & json, const OutputsSpec & outputsSpec) +void to_json(nlohmann::json & json, const ExtendedOutputsSpec & extendedOutputsSpec) { - if (std::get_if<DefaultOutputs>(&outputsSpec)) + if (std::get_if<DefaultOutputs>(&extendedOutputsSpec)) json = nullptr; - else if (std::get_if<AllOutputs>(&outputsSpec)) + else if (std::get_if<AllOutputs>(&extendedOutputsSpec)) json = std::vector<std::string>({"*"}); - else if (auto outputNames = std::get_if<OutputNames>(&outputsSpec)) + else if (auto outputNames = std::get_if<OutputNames>(&extendedOutputsSpec)) json = *outputNames; } -void from_json(const nlohmann::json & json, OutputsSpec & outputsSpec) +void from_json(const nlohmann::json & json, ExtendedOutputsSpec & extendedOutputsSpec) { if (json.is_null()) - outputsSpec = DefaultOutputs(); + extendedOutputsSpec = DefaultOutputs(); else { auto names = json.get<OutputNames>(); if (names == OutputNames({"*"})) - outputsSpec = AllOutputs(); + extendedOutputsSpec = AllOutputs(); else - outputsSpec = names; + extendedOutputsSpec = names; } } |