about summary refs log tree commit diff
path: root/src/nix-env/main.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-03-10T16·20+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-03-10T16·20+0000
commit37d1b1cafd17a18dc7dbef3b4ba7fb204158d58b (patch)
tree65ac3fdf078404a0957c5df5af855849e03be20f /src/nix-env/main.cc
parenta33fb2d28738376d377ea8473f6cffc39bc784c4 (diff)
* `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


Diffstat (limited to 'src/nix-env/main.cc')
-rw-r--r--src/nix-env/main.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index 4f299a7fe36d..f9a0c19a9b63 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);
         }