Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 690c230

Browse files
authored
Allow linkerd-examples to accept arguments (linkerd#475)
# Problem The run task on the linkerd example configurations does not accept arguments: ``` $ ./sbt 'linkerd-examples/transit:run --log.level=DEBUG' [info] Loading project definition from /Users/alex/workspace/linkerd/project [info] Set current project to all (in build file:/Users/alex/workspace/linkerd/) [error] Expected key [error] Expected '::' [error] Expected end of input. [error] linkerd-examples/transit:run --log.level=DEBUG ``` # Solution Parse arguments using "the exotic, elusive creature known as inputTaskDyn, with which even Stack Overflow cannot help you" (1) and feed them into `run`. (1) sbt/sbt#999
1 parent 07a57e8 commit 690c230

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

project/Base.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import com.typesafe.sbt.SbtScalariform.{scalariformSettings => baseScalariformSettings, _}
22
import sbt._
33
import sbt.Keys._
4+
import complete.Parsers.spaceDelimited
45
import sbtassembly.AssemblyKeys._
56
import sbtassembly.AssemblyPlugin.assemblySettings
67
import sbtassembly.MergeStrategy
@@ -117,10 +118,11 @@ class Base extends Build {
117118
// The runtime configuration may be different from the example configuration.
118119
runtimeConfiguration := configuration.value,
119120
run := // call linkerd's run command with a config file
120-
Def.taskDyn {
121+
Def.inputTaskDyn {
121122
val path = configFile.value.getPath
122-
(run in runtime in runtimeConfiguration.value).toTask(s" $path")
123-
}.value
123+
val args = spaceDelimited("<args>").parsed.mkString(" ")
124+
(run in runtime in runtimeConfiguration.value).toTask(s" $path $args")
125+
}.evaluated
124126
)
125127

126128
// Helper method for constructing projects from directory structure

0 commit comments

Comments
 (0)