diff options
author | Qyriad <qyriad@qyriad.me> | 2024-06-17 14:39:19 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-06-20 17:00:06 +0000 |
commit | 50be55ffca4d25e4e19175c18cd88f6046757652 (patch) | |
tree | 7364e27b3f087ac28bfee9fb9ef87c37fa1d69e9 /src/nix | |
parent | 079eeb1de72aeed6f9da16982c099d9936098ba6 (diff) |
de-inheritance CmdEdit for InstallableValueCommand
Change-Id: If85ea78954a45470b0b25c08dc7d40bfebd53610
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/edit.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nix/edit.cc b/src/nix/edit.cc index d1741a254..2f701f145 100644 --- a/src/nix/edit.cc +++ b/src/nix/edit.cc @@ -1,4 +1,4 @@ -#include "command-installable-value.hh" +#include "command.hh" #include "shared.hh" #include "eval.hh" #include "attr-path.hh" @@ -10,7 +10,7 @@ using namespace nix; -struct CmdEdit : InstallableValueCommand +struct CmdEdit : InstallableCommand { std::string description() override { @@ -26,17 +26,19 @@ struct CmdEdit : InstallableValueCommand Category category() override { return catSecondary; } - void run(ref<Store> store, ref<InstallableValue> installable) override + void run(ref<Store> store, ref<Installable> installable) override { auto state = getEvalState(); + auto const installableValue = InstallableValue::require(installable); + const auto [file, line] = [&] { - auto [v, pos] = installable->toValue(*state); + auto [v, pos] = installableValue->toValue(*state); try { return findPackageFilename(*state, *v, installable->what()); } catch (NoPositionInfo &) { - throw Error("cannot find position information for '%s", installable->what()); + throw Error("cannot find position information for '%s", installableValue->what()); } }(); |