Skip to content

Multiple directives warning in Scala-cli projects that also have executable .sc scripts #3028

Open
@spamegg1

Description

@spamegg1

Version(s)
1.4.0

Describe what needs to be done and why

What's the best practice for:

  • having a Scala-cli project, with project.scala, and

  • having executable .sc scripts (with #!/usr/bin/env -S scala-cli) in the same project (that can be run like ./myScript.sc)

One issue is the warning on the //> using directives of the scripts. The warning says to move them into project.scala, but then the scripts cannot be run stand-alone from the Terminal. (Also those directives aren't needed in the project itself, just needed in the scripts... but the scripts are needed along with the project, for the use case.)

Describe alternatives you've considered

One alternative is to simply suppress the warning for executable scripts.

Another is to somehow make use of directives from project.scala in the scripts.

One more option is to give up on the shebang scripts (with #!/usr/bin/env -S scala-cli) and ask my users to do scala-cli run . myScript.sc or something like that. (That way, directives in project.scala are used I think.)

Additional context

Screenshot_from_2024-07-14_23-11-20

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXdocumentationImprovements or additions to documentationscriptingIssues tied to *.sc script inputs.using directivesIssues tied with using directives.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions