mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
refactor: factor out getValue
This commit is contained in:
parent
9f8c1183fa
commit
7534798eed
1 changed files with 16 additions and 12 deletions
|
@ -920,18 +920,22 @@ struct CmdRepl : InstallablesCommand
|
|||
void run(ref<Store> store) override
|
||||
{
|
||||
auto state = getEvalState();
|
||||
auto repl = std::make_unique<NixRepl>(searchPath, openStore(),state
|
||||
,[&]()->NixRepl::AnnotatedValues{
|
||||
auto installables = load();
|
||||
NixRepl::AnnotatedValues values;
|
||||
for (auto & installable: installables){
|
||||
auto [val, pos] = installable->toValue(*state);
|
||||
auto what = installable->what();
|
||||
values.push_back( {val,what} );
|
||||
}
|
||||
return values;
|
||||
}
|
||||
);
|
||||
auto getValues = [&]()->NixRepl::AnnotatedValues{
|
||||
auto installables = load();
|
||||
NixRepl::AnnotatedValues values;
|
||||
for (auto & installable: installables){
|
||||
auto [val, pos] = installable->toValue(*state);
|
||||
auto what = installable->what();
|
||||
values.push_back( {val,what} );
|
||||
}
|
||||
return values;
|
||||
};
|
||||
auto repl = std::make_unique<NixRepl>(
|
||||
searchPath,
|
||||
openStore(),
|
||||
state,
|
||||
getValues
|
||||
);
|
||||
repl->autoArgs = getAutoArgs(*repl->state);
|
||||
repl->mainLoop();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue