aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-17 17:05:37 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-17 17:05:37 +0200
commit0d69f7f3f012aceb4c494f3c1cc866b378c5eac1 (patch)
treecbaa4357676c7924ad49c1a3c972379d30744b82
parent2467c9837500b26aab5c1dcd3cac12cda44898ca (diff)
nix app: Accept arguments
Example: $ nix app blender-bin -- --version Blender 2.80 (sub 74)
-rw-r--r--src/nix/run.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nix/run.cc b/src/nix/run.cc
index 62aae12f6..d30851d47 100644
--- a/src/nix/run.cc
+++ b/src/nix/run.cc
@@ -196,8 +196,11 @@ static RegisterCommand r1(make_ref<CmdRun>());
struct CmdApp : InstallableCommand, RunCommon
{
+ std::vector<std::string> args;
+
CmdApp()
{
+ expectArgs("args", &args);
}
std::string name() override
@@ -238,7 +241,10 @@ struct CmdApp : InstallableCommand, RunCommon
state->realiseContext(app.context);
- runProgram(store, app.program, {app.program});
+ Strings allArgs{app.program};
+ for (auto & i : args) allArgs.push_back(i);
+
+ runProgram(store, app.program, allArgs);
}
};