forked from lix-project/lix
Include fetcher input scheme info in the CLI dump
Leverages the previous commit.
This commit is contained in:
parent
8381eeda6f
commit
077de2968e
|
@ -19,6 +19,19 @@ void registerInputScheme(std::shared_ptr<InputScheme> && inputScheme)
|
|||
inputSchemes->insert_or_assign(schemeName, std::move(inputScheme));
|
||||
}
|
||||
|
||||
nlohmann::json dumpRegisterInputSchemeInfo() {
|
||||
using nlohmann::json;
|
||||
|
||||
auto res = json::object();
|
||||
|
||||
for (auto & [name, scheme] : *inputSchemes) {
|
||||
auto & r = res[name] = json::object();
|
||||
r["allowedAttrs"] = scheme->allowedAttrs();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Input Input::fromURL(const std::string & url, bool requireTree)
|
||||
{
|
||||
return fromURL(parseURL(url), requireTree);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "url.hh"
|
||||
|
||||
#include <memory>
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
namespace nix { class Store; }
|
||||
|
||||
|
@ -170,4 +171,6 @@ struct InputScheme
|
|||
|
||||
void registerInputScheme(std::shared_ptr<InputScheme> && fetcher);
|
||||
|
||||
nlohmann::json dumpRegisterInputSchemeInfo();
|
||||
|
||||
}
|
||||
|
|
|
@ -188,6 +188,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
|
|||
j["experimentalFeature"] = storeConfig->experimentalFeature();
|
||||
}
|
||||
res["stores"] = std::move(stores);
|
||||
res["fetchers"] = fetchers::dumpRegisterInputSchemeInfo();
|
||||
|
||||
return res.dump();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue