diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-02-19 16:18:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-19 16:18:53 +0100 |
commit | 548437c2347159c4c79352283dd12ce58324f1d6 (patch) | |
tree | de7b67aef8275de7efd5ec05e0b4fb4f1e9b8b23 /src/libcmd | |
parent | f483b623e98a0feb2568e5be076b533c5838ba32 (diff) | |
parent | ad337c8697099ac9deb6e0ac16ea91d8acc51e4f (diff) |
Merge pull request #4541 from obsidiansystems/simpler-store-path-command
Deeper `Command` hierarchy to remove redundancy
Diffstat (limited to 'src/libcmd')
-rw-r--r-- | src/libcmd/command.cc | 4 | ||||
-rw-r--r-- | src/libcmd/command.hh | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index efdc98d5a..d29954f67 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -118,10 +118,8 @@ void StorePathsCommand::run(ref<Store> store, std::vector<RealisedPath> paths) run(store, std::move(storePaths)); } -void StorePathCommand::run(ref<Store> store) +void StorePathCommand::run(ref<Store> store, std::vector<StorePath> storePaths) { - auto storePaths = toStorePaths(store, Realise::Nothing, operateOn, installables); - if (storePaths.size() != 1) throw UsageError("this command requires exactly one store path"); diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh index 8c0b3a94a..c02193924 100644 --- a/src/libcmd/command.hh +++ b/src/libcmd/command.hh @@ -177,13 +177,13 @@ struct StorePathsCommand : public RealisedPathsCommand }; /* A command that operates on exactly one store path. */ -struct StorePathCommand : public InstallablesCommand +struct StorePathCommand : public StorePathsCommand { - using StoreCommand::run; + using StorePathsCommand::run; virtual void run(ref<Store> store, const StorePath & storePath) = 0; - void run(ref<Store> store) override; + void run(ref<Store> store, std::vector<StorePath> storePaths) override; }; /* A helper class for registering commands globally. */ |