@@ -34,9 +34,10 @@ import scala.cli.util.ConfigDbUtils.*
34
34
import scala .cli .{CurrentParams , ScalaCli }
35
35
import scala .util .{Properties , Try }
36
36
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 )
39
39
with NeedsArgvCommand with CommandHelpers with RestrictableCommand [T ] {
40
+
40
41
private val globalOptionsAtomic : AtomicReference [GlobalOptions ] =
41
42
new AtomicReference (GlobalOptions .default)
42
43
@@ -83,7 +84,7 @@ abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T],
83
84
val maxCommandLength : Int = names.map(_.length).max max 1
84
85
val maxPotentialCommandNames = argv.slice(1 , maxCommandLength + 1 ).toList
85
86
validCommand(maxPotentialCommandNames).getOrElse(List (" " ))
86
- }.getOrElse(List (name )).mkString(" " )
87
+ }.getOrElse(List (inHelp.progName )).mkString(" " )
87
88
88
89
protected def actualFullCommand : String =
89
90
if actualCommandName.nonEmpty then s " $progName $actualCommandName" else progName
@@ -293,30 +294,30 @@ abstract class ScalaCommand[T <: HasGlobalOptions](implicit myParser: Parser[T],
293
294
294
295
override val messages : Help [T ] =
295
296
if shouldExcludeInSip then
296
- Help [ T ] (helpMessage =
297
+ inHelp.copy (helpMessage =
297
298
Some (HelpMessage (WarningMessages .powerCommandUsedInSip(
298
299
actualCommandName,
299
300
scalaSpecificationLevel
300
301
)))
301
302
)
302
303
else if isExperimental then
303
- help .copy(helpMessage =
304
- help .helpMessage.map(hm =>
304
+ inHelp .copy(helpMessage =
305
+ inHelp .helpMessage.map(hm =>
305
306
hm.copy(
306
307
message =
307
308
s """ ${hm.message}
308
309
|
309
- | ${WarningMessages .experimentalSubcommandWarning(name )}""" .stripMargin,
310
+ | ${WarningMessages .experimentalSubcommandWarning(inHelp.progName )}""" .stripMargin,
310
311
detailedMessage =
311
312
if hm.detailedMessage.nonEmpty then
312
313
s """ ${hm.detailedMessage}
313
314
|
314
- | ${WarningMessages .experimentalSubcommandWarning(name )}""" .stripMargin
315
+ | ${WarningMessages .experimentalSubcommandWarning(inHelp.progName )}""" .stripMargin
315
316
else hm.detailedMessage
316
317
)
317
318
)
318
319
)
319
- else help
320
+ else inHelp
320
321
321
322
/** @param options
322
323
* command-specific [[T ]] options
0 commit comments