about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-07T18·42+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-07T18·42+0200
commit24e23a1a73d573c5d0cda86c34e0e1fd5aef9171 (patch)
tree9aa61967e83db59e49fcf6ae740c1adced481a6b /src
parent4967f0509aca0001156d937f36ed8eb17c72d752 (diff)
nix search: Add examples
Diffstat (limited to 'src')
-rw-r--r--src/nix/search.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nix/search.cc b/src/nix/search.cc
index 6e099ce377f1..9476b79fbc1b 100644
--- a/src/nix/search.cc
+++ b/src/nix/search.cc
@@ -56,6 +56,24 @@ struct CmdSearch : SourceExprCommand, MixJSON
         return "query available packages";
     }
 
+    Examples examples() override
+    {
+        return {
+            Example{
+                "To show all available packages:",
+                "nix search"
+            },
+            Example{
+                "To show any packages containing 'blender' in its name or description:",
+                "nix search blender"
+            },
+            Example{
+                "To search for Firefox and Chromium:",
+                "nix search 'firefox|chromium'"
+            },
+        };
+    }
+
     void run(ref<Store> store) override
     {
         settings.readOnlyMode = true;