aboutsummaryrefslogtreecommitdiff
path: root/src/nix-env
diff options
context:
space:
mode:
authorYI <uuuuuu@protonmail.com>2020-03-01 16:11:22 +0800
committerYI <uuuuuu@protonmail.com>2020-03-14 00:36:26 +0800
commitb6d794fb8df09b9b5d86f3fe2a2789631215f8b5 (patch)
treefdd911b89100969733f43358c525ebeb527c38b6 /src/nix-env
parent22a754c091f765061f59bef5ce091268493bb138 (diff)
display attr-path only when queried available
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/nix-env.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index a40d0c7e6..106dfe0b6 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -914,6 +914,8 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
throw UsageError(format("unknown flag '%1%'") % arg);
}
+ if (printAttrPath && source != sAvailable)
+ throw UsageError("--attr-path(-P) only works with --available");
/* Obtain derivation information from the specified source. */
DrvInfos availElems, installedElems;