aboutsummaryrefslogtreecommitdiff
path: root/src/nix/search.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-04-16 15:36:15 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-04-16 19:52:39 +0200
commit3b489e8843f4730d4dd0753453ccb1c21429b0e9 (patch)
treef7954b0dc6f5d3ae64b17e126bc87b5e9fa6c538 /src/nix/search.cc
parent29043e7e9edad1ff81b45ec147da32fbd6607385 (diff)
Add 'nix flake show' command
Diffstat (limited to 'src/nix/search.cc')
-rw-r--r--src/nix/search.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nix/search.cc b/src/nix/search.cc
index caea25cdc..7f4bd818f 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -29,7 +29,7 @@ std::string hilite(const std::string & s, const std::smatch & m, std::string pos
+ std::string(m.suffix());
}
-struct CmdSearch : SourceExprCommand, MixJSON
+struct CmdSearch : InstallableCommand, MixJSON
{
std::vector<std::string> res;
@@ -79,6 +79,11 @@ struct CmdSearch : SourceExprCommand, MixJSON
};
}
+ Strings getDefaultFlakeAttrPaths() override
+ {
+ return {""};
+ }
+
void run(ref<Store> store) override
{
settings.readOnlyMode = true;
@@ -93,12 +98,14 @@ struct CmdSearch : SourceExprCommand, MixJSON
std::vector<std::regex> regexes;
regexes.reserve(res.size());
- for (auto &re : res) {
+ for (auto & re : res)
regexes.push_back(std::regex(re, std::regex::extended | std::regex::icase));
- }
auto state = getEvalState();
+ //auto [value, pos] = installable->toValue(*state);
+
+#if 0
auto jsonOut = json ? std::make_unique<JSONObject>(std::cout) : nullptr;
auto sToplevel = state->symbols.create("_toplevel");
@@ -270,7 +277,7 @@ struct CmdSearch : SourceExprCommand, MixJSON
RunPager pager;
for (auto el : results) std::cout << el.second << "\n";
-
+#endif
}
};