-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1192 from alexarchambault/custom-directive-groups
Add support for custom directive groups
- Loading branch information
Showing
11 changed files
with
293 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
modules/scala/shared-directives/src/main/scala/almond/launcher/directives/CustomGroup.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package almond.launcher.directives | ||
|
||
case class CustomGroup( | ||
prefix: String, | ||
command: String | ||
) { | ||
private lazy val prefix0 = prefix + "." | ||
def matches(key: String): Boolean = | ||
key == prefix || key.startsWith(prefix0) | ||
} |
22 changes: 22 additions & 0 deletions
22
modules/scala/shared-directives/src/main/scala/almond/launcher/directives/JavaCommand.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package almond.launcher.directives | ||
|
||
import scala.cli.directivehandler._ | ||
|
||
@DirectiveGroupName("Java command") | ||
@DirectiveExamples("//> using javaCmd \"java\" \"-Dfoo=thing\"") | ||
@DirectiveUsage( | ||
"//> using javaCmd _args_", | ||
"`//> using javaCmd` _args_" | ||
) | ||
@DirectiveDescription("Specify a java command to run the Scala version-specific kernel") | ||
final case class JavaCommand( | ||
javaCmd: Option[List[String]] = None | ||
) extends HasLauncherParameters { | ||
def launcherParameters = LauncherParameters( | ||
javaCmd = javaCmd.filter(_.exists(_.nonEmpty)) | ||
) | ||
} | ||
|
||
object JavaCommand { | ||
val handler: DirectiveHandler[JavaCommand] = DirectiveHandler.deriver[JavaCommand].derive | ||
} |
Oops, something went wrong.