From 50be55ffca4d25e4e19175c18cd88f6046757652 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Mon, 17 Jun 2024 14:39:19 -0600 Subject: de-inheritance CmdEdit for InstallableValueCommand Change-Id: If85ea78954a45470b0b25c08dc7d40bfebd53610 --- src/nix/edit.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/nix') 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, ref installable) override + void run(ref store, ref 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()); } }(); -- cgit v1.2.3