nix edit / log: Operate on a single Installable

This commit is contained in:
Eelco Dolstra 2017-08-29 16:18:00 +02:00
parent 9b82ecbae0
commit e9c07a3b26
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 109 additions and 98 deletions

View file

@ -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
{