Skip to content

Commit c9c659c

Browse files
authored
Merge pull request #3152 from coreyoconnor/break-recursive-init-oddness
Change how help is referenced to avoid initialization oddness & update `case-app` to 2.1.0-M29
2 parents 5da0e9a + b2ce3f7 commit c9c659c

File tree

6 files changed

+13
-24
lines changed

6 files changed

+13
-24
lines changed

modules/cli/src/main/scala/scala/cli/commands/ScalaCommand.scala

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ import scala.cli.util.ConfigDbUtils.*
3434
import scala.cli.{CurrentParams, ScalaCli}
3535
import scala.util.{Properties, Try}
3636

37-
abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T], help: Help[T])
38-
extends Command()(myParser, help)
37+
abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T], inHelp: Help[T])
38+
extends Command()(myParser, inHelp)
3939
with NeedsArgvCommand with CommandHelpers with RestrictableCommand[T] {
40+
4041
private val globalOptionsAtomic: AtomicReference[GlobalOptions] =
4142
new AtomicReference(GlobalOptions.default)
4243

@@ -83,7 +84,7 @@ abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T],
8384
val maxCommandLength: Int = names.map(_.length).max max 1
8485
val maxPotentialCommandNames = argv.slice(1, maxCommandLength + 1).toList
8586
validCommand(maxPotentialCommandNames).getOrElse(List(""))
86-
}.getOrElse(List(name)).mkString(" ")
87+
}.getOrElse(List(inHelp.progName)).mkString(" ")
8788

8889
protected def actualFullCommand: String =
8990
if actualCommandName.nonEmpty then s"$progName $actualCommandName" else progName
@@ -293,30 +294,30 @@ abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T],
293294

294295
override val messages: Help[T] =
295296
if shouldExcludeInSip then
296-
Help[T](helpMessage =
297+
inHelp.copy(helpMessage =
297298
Some(HelpMessage(WarningMessages.powerCommandUsedInSip(
298299
actualCommandName,
299300
scalaSpecificationLevel
300301
)))
301302
)
302303
else if isExperimental then
303-
help.copy(helpMessage =
304-
help.helpMessage.map(hm =>
304+
inHelp.copy(helpMessage =
305+
inHelp.helpMessage.map(hm =>
305306
hm.copy(
306307
message =
307308
s"""${hm.message}
308309
|
309-
|${WarningMessages.experimentalSubcommandWarning(name)}""".stripMargin,
310+
|${WarningMessages.experimentalSubcommandWarning(inHelp.progName)}""".stripMargin,
310311
detailedMessage =
311312
if hm.detailedMessage.nonEmpty then
312313
s"""${hm.detailedMessage}
313314
|
314-
|${WarningMessages.experimentalSubcommandWarning(name)}""".stripMargin
315+
|${WarningMessages.experimentalSubcommandWarning(inHelp.progName)}""".stripMargin
315316
else hm.detailedMessage
316317
)
317318
)
318319
)
319-
else help
320+
else inHelp
320321

321322
/** @param options
322323
* command-specific [[T]] options

modules/cli/src/main/scala/scala/cli/commands/package0/PackageOptions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ final case class PackageOptions(
5050
@HelpMessage("Generate a source JAR rather than an executable JAR")
5151
@Name("sources")
5252
@Name("src")
53-
@Name("sourceJar")
5453
@Tag(tags.restricted)
5554
@Tag(tags.inShortHelp)
5655
source: Boolean = false,

modules/cli/src/main/scala/scala/cli/commands/pgp/PgpPushOptions.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ final case class PgpPushOptions(
2424
@Group(HelpGroup.PGP.toString)
2525
@HelpMessage("Whether to exit with code 0 if no key is passed")
2626
allowEmpty: Boolean = false,
27-
@Group(HelpGroup.PGP.toString)
28-
@HelpMessage("When running Scala CLI on the JVM, force running scala-cli-singing using a native launcher or a JVM launcher")
29-
@Hidden
30-
forceSigningExternally: Boolean = false
3127
) extends HasGlobalOptions
3228
// format: on
3329

modules/integration/src/test/scala/scala/cli/integration/InstallAndUninstallCompletionsTests.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class InstallAndUninstallCompletionsTests extends ScalaCliSuite {
6969
lazy val fishRcScript: String = {
7070
val progName = "scala-cli"
7171
val script =
72-
s"""
73-
complete $progName -a '($progName complete fish-v1 (math 1 + (count (__fish_print_cmd_args))) (__fish_print_cmd_args))'
74-
|""".stripMargin
72+
s"""complete $progName -a '($progName complete fish-v1 (math 1 + (count (__fish_print_cmd_args))) (__fish_print_cmd_args))'"""
7573
addTags(script)
7674
}
7775

project/deps.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ object Deps {
142142
.exclude(("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_2.13"))
143143
def bloopRifle = ivy"ch.epfl.scala:bloop-rifle_2.13:${Versions.bloop}"
144144
def bsp4j = ivy"ch.epfl.scala:bsp4j:2.1.1"
145-
def caseApp = ivy"com.github.alexarchambault::case-app:2.1.0-M28"
145+
def caseApp = ivy"com.github.alexarchambault::case-app:2.1.0-M29"
146146
def collectionCompat = ivy"org.scala-lang.modules::scala-collection-compat:2.12.0"
147147
// Force using of 2.13 - is there a better way?
148148
def coursier = ivy"io.get-coursier:coursier_2.13:${Versions.coursier}"

website/docs/reference/cli-options.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ Generate a library JAR rather than an executable JAR
751751

752752
### `--source`
753753

754-
Aliases: `--source-jar`, `--sources`, `--src`
754+
Aliases: `--sources`, `--src`
755755

756756
Generate a source JAR rather than an executable JAR
757757

@@ -2122,11 +2122,6 @@ Try to push the key even if Scala CLI thinks it's not a public key
21222122
[Internal]
21232123
Whether to exit with code 0 if no key is passed
21242124

2125-
### `--force-signing-externally`
2126-
2127-
[Internal]
2128-
When running Scala CLI on the JVM, force running scala-cli-singing using a native launcher or a JVM launcher
2129-
21302125
### Pgp scala signing options
21312126

21322127
Available in commands:

0 commit comments

Comments
 (0)