about summary refs log tree commit diff
path: root/src/nix-env/nix-env.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-03T13·56+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-09-03T14·35+0200
commit88c07341a6bf99f923cb3d6487b72afc025b7746 (patch)
tree4a2f0d8abbfbb33f2cbe465724efa221381945c9 /src/nix-env/nix-env.cc
parent07a08bddf001271b4b7eff2a119c395f40119966 (diff)
nix-env: Use wildcard match by default
That is, you don't need to pass '*' anymore, so

  nix-env -qa

is equivalent to

  nix-env -qa '*'
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r--src/nix-env/nix-env.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 9f51e919b0e9..2a66743eebca 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -243,13 +243,13 @@ static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems,
     const Strings & args, bool newestOnly)
 {
     DrvNames selectors = drvNamesFromArgs(args);
+    if (selectors.empty())
+        selectors.push_back(DrvName("*"));
 
     DrvInfos elems;
     set<unsigned int> done;
 
-    for (DrvNames::iterator i = selectors.begin();
-         i != selectors.end(); ++i)
-    {
+    foreach (DrvNames::iterator, i, selectors) {
         typedef list<std::pair<DrvInfo, unsigned int> > Matches;
         Matches matches;
         unsigned int n = 0;
@@ -321,8 +321,7 @@ static DrvInfos filterBySelector(EvalState & state, const DrvInfos & allElems,
     }
 
     /* Check that all selectors have been used. */
-    for (DrvNames::iterator i = selectors.begin();
-         i != selectors.end(); ++i)
+    foreach (DrvNames::iterator, i, selectors)
         if (i->hits == 0 && i->fullName != "*")
             throw Error(format("selector `%1%' matches no derivations")
                 % i->fullName);
@@ -913,9 +912,6 @@ static void opQuery(Globals & globals,
         else remaining.push_back(arg);
     }
 
-    if (remaining.size() == 0)
-        printMsg(lvlInfo, "warning: you probably meant to specify the argument '*' to show all packages");
-
 
     /* Obtain derivation information from the specified source. */
     DrvInfos availElems, installedElems;