aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-05-11 15:46:18 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-05-11 15:57:45 +0200
commit4c3c638a05e52cdc3bd96255873b711a28630288 (patch)
tree627e46d9835ef9ba3be2c49dd27b9543d750f97f /src/nix
parent0884f180f5ca8a864e6db5256eaa10646e87d671 (diff)
Cleanup
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/cat.cc12
-rw-r--r--src/nix/command.hh5
-rw-r--r--src/nix/hash.cc6
-rw-r--r--src/nix/installables.cc8
-rw-r--r--src/nix/ls.cc12
-rw-r--r--src/nix/repl.cc6
-rw-r--r--src/nix/run.cc6
7 files changed, 44 insertions, 11 deletions
diff --git a/src/nix/cat.cc b/src/nix/cat.cc
index eeee1e529..b528a0507 100644
--- a/src/nix/cat.cc
+++ b/src/nix/cat.cc
@@ -25,7 +25,11 @@ struct CmdCatStore : StoreCommand, MixCat
{
CmdCatStore()
{
- expectPathArg("path", &path);
+ expectArgs({
+ .label = "path",
+ .handler = {&path},
+ .completer = completePath
+ });
}
std::string description() override
@@ -47,7 +51,11 @@ struct CmdCatNar : StoreCommand, MixCat
CmdCatNar()
{
- expectPathArg("nar", &narPath);
+ expectArgs({
+ .label = "nar",
+ .handler = {&narPath},
+ .completer = completePath
+ });
expectArg("path", &path);
}
diff --git a/src/nix/command.hh b/src/nix/command.hh
index 6b4781303..0738c0f91 100644
--- a/src/nix/command.hh
+++ b/src/nix/command.hh
@@ -73,10 +73,7 @@ struct InstallablesCommand : virtual Args, SourceExprCommand
{
std::vector<std::shared_ptr<Installable>> installables;
- InstallablesCommand()
- {
- expectArgs("installables", &_installables);
- }
+ InstallablesCommand();
void prepare() override;
diff --git a/src/nix/hash.cc b/src/nix/hash.cc
index 0f460c668..d5636eb47 100644
--- a/src/nix/hash.cc
+++ b/src/nix/hash.cc
@@ -31,7 +31,11 @@ struct CmdHash : Command
.labels({"modulus"})
.dest(&modulus);
#endif
- expectPathArgs("paths", &paths);
+ expectArgs({
+ .label = "paths",
+ .handler = {&paths},
+ .completer = completePath
+ });
}
std::string description() override
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index c144a7e70..abc642e11 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -571,6 +571,14 @@ StorePathSet toDerivations(ref<Store> store,
return drvPaths;
}
+InstallablesCommand::InstallablesCommand()
+{
+ expectArgs({
+ .label = "installables",
+ .handler = {&_installables},
+ });
+}
+
void InstallablesCommand::prepare()
{
if (_installables.empty() && useDefaultInstallables())
diff --git a/src/nix/ls.cc b/src/nix/ls.cc
index aac082422..dc7e370b9 100644
--- a/src/nix/ls.cc
+++ b/src/nix/ls.cc
@@ -85,7 +85,11 @@ struct CmdLsStore : StoreCommand, MixLs
{
CmdLsStore()
{
- expectPathArg("path", &path);
+ expectArgs({
+ .label = "path",
+ .handler = {&path},
+ .completer = completePath
+ });
}
Examples examples() override
@@ -117,7 +121,11 @@ struct CmdLsNar : Command, MixLs
CmdLsNar()
{
- expectPathArg("nar", &narPath);
+ expectArgs({
+ .label = "nar",
+ .handler = {&narPath},
+ .completer = completePath
+ });
expectArg("path", &path);
}
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index 2e7b14d08..c936f9cc2 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -767,7 +767,11 @@ struct CmdRepl : StoreCommand, MixEvalArgs
CmdRepl()
{
- expectPathArgs("files", &files);
+ expectArgs({
+ .label = "files",
+ .handler = {&files},
+ .completer = completePath
+ });
}
std::string description() override
diff --git a/src/nix/run.cc b/src/nix/run.cc
index 3701ffe3d..f9b1298f1 100644
--- a/src/nix/run.cc
+++ b/src/nix/run.cc
@@ -149,7 +149,11 @@ struct CmdRun : InstallableCommand, RunCommon
CmdRun()
{
- expectPathArgs("args", &args);
+ expectArgs({
+ .label = "args",
+ .handler = {&args},
+ .completer = completePath
+ });
}
std::string description() override