about summary refs log tree commit diff
path: root/src/nix/command.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-29T14·18+0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-29T14·18+0200
commite9c07a3b26a1e3056538a8fce49c9f7d9f1d8aba (patch)
treeb6e5559aeaa066cbb454876d1cdbffcd7582ad45 /src/nix/command.hh
parent9b82ecbae04e36cb8f009510716268fa72a067b8 (diff)
nix edit / log: Operate on a single Installable
Diffstat (limited to 'src/nix/command.hh')
-rw-r--r--src/nix/command.hh20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/nix/command.hh b/src/nix/command.hh
index b159408c3a98..479e6fd3742f 100644
--- a/src/nix/command.hh
+++ b/src/nix/command.hh
@@ -51,7 +51,7 @@ struct Installable
 {
     virtual std::string what() = 0;
 
-    virtual Buildables toBuildable()
+    virtual Buildables toBuildable(bool singular = false)
     {
         throw Error("argument '%s' cannot be built", what());
     }
@@ -97,8 +97,6 @@ struct InstallablesCommand : virtual Args, SourceExprCommand
         expectArgs("installables", &_installables);
     }
 
-    std::vector<std::shared_ptr<Installable>> parseInstallables(ref<Store> store, Strings ss);
-
     enum ToStorePathsMode { Build, NoBuild, DryRun };
 
     PathSet toStorePaths(ref<Store> store, ToStorePathsMode mode);
@@ -112,6 +110,22 @@ private:
     Strings _installables;
 };
 
+struct InstallableCommand : virtual Args, SourceExprCommand
+{
+    std::shared_ptr<Installable> installable;
+
+    InstallableCommand()
+    {
+        expectArg("installable", &_installable);
+    }
+
+    void prepare() override;
+
+private:
+
+    std::string _installable;
+};
+
 /* A command that operates on zero or more store paths. */
 struct StorePathsCommand : public InstallablesCommand
 {