From 0e6dc72a7a4d29b7f1a1458670581a29d573e479 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 25 Jul 2006 16:40:38 +0000 Subject: * Applied rbroek's patch from the branch at https://svn.cs.uu.nl:12443/repos/trace/buildfarm-control/trunk/ext/nix/, with some modifications. This allows `nix-env -qa' to show the attribute path that can be used to unambiguously install a package using `nix-env -i -A'. Example: $ nix-env -f top-level/all-packages.nix -qaA subversion xorg-server subversionWithJava subversion-1.2.3 subversion subversion-1.3.2 subversion14 subversion-1.4.0pre-rc1 xorg.xorgserver xorg-server-1.1.0 --- src/nix-env/main.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nix-env/main.cc') diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index 633c85b618f7..875cdd7447e8 100644 --- a/src/nix-env/main.cc +++ b/src/nix-env/main.cc @@ -724,6 +724,7 @@ static void opQuery(Globals & globals, { bool printStatus = false; bool printName = true; + bool printAttrPath = false; bool printSystem = false; bool printDrvPath = false; bool printOutPath = false; @@ -747,6 +748,8 @@ static void opQuery(Globals & globals, else if (*i == "--available" || *i == "-a") source = sAvailable; else throw UsageError(format("unknown flag `%1%'") % *i); + if (globals.instSource.type == srcAttrPath) printAttrPath = true; /* hack */ + if (opArgs.size() == 0) { printMsg(lvlInfo, "warning: you probably meant to specify the argument '*' to show all packages"); } @@ -809,6 +812,8 @@ static void opQuery(Globals & globals, + (subs.size() > 0 ? "S" : "-")); } + if (printAttrPath) columns.push_back(i->attrPath); + if (printName) columns.push_back(i->name); if (compareVersions) { -- cgit 1.4.1