From 37d1b1cafd17a18dc7dbef3b4ba7fb204158d58b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Mar 2006 16:20:42 +0000 Subject: * `nix-env -qa --description' shows human-readable descriptions of packages (provided that they have a `meta.description' attribute). E.g., $ ./src/nix-env/nix-env -qa --description gcc gcc-4.0.2 GNU Compiler Collection, 4.0.x (cross-compiler for sparc-linux) gcc-4.0.2 GNU Compiler Collection, 4.0.x (cross-compiler for mips-linux) gcc-4.0.2 GNU Compiler Collection, 4.0.x (cross-compiler for arm-linux) gcc-4.0.2 GNU Compiler Collection, 4.0.x --- src/nix-env/main.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/nix-env/main.cc') diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index 4f299a7fe3..f9a0c19a9b 100644 --- a/src/nix-env/main.cc +++ b/src/nix-env/main.cc @@ -699,6 +699,7 @@ static void opQuery(Globals & globals, bool printSystem = false; bool printDrvPath = false; bool printOutPath = false; + bool printDescription = false; bool compareVersions = false; enum { sInstalled, sAvailable } source = sInstalled; @@ -710,6 +711,7 @@ static void opQuery(Globals & globals, if (*i == "--status" || *i == "-s") printStatus = true; else if (*i == "--no-name") printName = false; else if (*i == "--system") printSystem = true; + else if (*i == "--description") printDescription = true; else if (*i == "--compare-versions" || *i == "-c") compareVersions = true; else if (*i == "--drv-path") printDrvPath = true; else if (*i == "--out-path") printOutPath = true; @@ -808,6 +810,11 @@ static void opQuery(Globals & globals, ? "-" : i->queryDrvPath(globals.state)); if (printOutPath) columns.push_back(i->queryOutPath(globals.state)); + + if (printDescription) { + MetaInfo meta = i->queryMetaInfo(globals.state); + columns.push_back(meta["description"]); + } table.push_back(columns); } -- cgit 1.4.1