about summary refs log tree commit diff
path: root/src/nix/command.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-25T11·20+0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-25T11·20+0200
commit7ee81f3887353cae2feecb98b482badf57a1fd5b (patch)
treec06ad44f0d0901c92e68b0284281691ee753c5fc /src/nix/command.hh
parentc769841bc4ecb9dd3d8456931fec78e102c3832f (diff)
Make StorePathsCommand a subclass of InstallablesCommand
This allows commands like 'nix path-info', 'nix copy', 'nix verify'
etc. to work on arbitrary installables. E.g. to copy geeqie to a
binary cache:

  $ nix copy -r --to file:///tmp/binary-cache nixpkgs.geeqie

Or to get the closure size of thunderbird:

  $ nix path-info -S nixpkgs.thunderbird
Diffstat (limited to 'src/nix/command.hh')
-rw-r--r--src/nix/command.hh39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/nix/command.hh b/src/nix/command.hh
index ee9485e5dd14..dc7b2637d66a 100644
--- a/src/nix/command.hh
+++ b/src/nix/command.hh
@@ -44,26 +44,6 @@ private:
     std::shared_ptr<Store> _store;
 };
 
-/* A command that operates on zero or more store paths. */
-struct StorePathsCommand : public StoreCommand
-{
-private:
-
-    Paths storePaths;
-    bool recursive = false;
-    bool all = false;
-
-public:
-
-    StorePathsCommand();
-
-    using StoreCommand::run;
-
-    virtual void run(ref<Store> store, Paths storePaths) = 0;
-
-    void run(ref<Store> store) override;
-};
-
 struct Installable
 {
     virtual std::string what() = 0;
@@ -115,6 +95,25 @@ private:
     Value * vSourceExpr = 0;
 };
 
+/* A command that operates on zero or more store paths. */
+struct StorePathsCommand : public InstallablesCommand
+{
+private:
+
+    bool recursive = false;
+    bool all = false;
+
+public:
+
+    StorePathsCommand();
+
+    using StoreCommand::run;
+
+    virtual void run(ref<Store> store, Paths storePaths) = 0;
+
+    void run(ref<Store> store) override;
+};
+
 typedef std::map<std::string, ref<Command>> Commands;
 
 /* An argument parser that supports multiple subcommands,