scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

`scala-cli config interactive true` should be on by default

Open bjornregnell opened this issue 3 years ago • 2 comments

Version(s) 0.1.12

Describe the bug Beginners don't know --main-class and it is natural to have the sbt-like UX when multiple mains give selection out of the box.

To Reproduce Create multiple mains and the user gets an error.

Expected behaviour The user should be presented with a choice and scala-cli config interactive true should be the default as this is IMHO better UX for beginners.

bjornregnell avatar Aug 31 '22 17:08 bjornregnell

The user already is presented with this choice.

The first time the --interactive flag is passed, Scala CLI will ask if you want it on permanently.

▶ scala-cli . --interactive                         
You have run the current scala-cli command with the --interactive mode turned on.
Would you like to leave it on permanently?
[0] Yes
[1] No
0
--interactive is now set permanently. All future scala-cli commands will run with the flag set to true.
If you want to turn this setting off at any point, just run `scala-cli config interactive false`.
Found several main classes. Which would you like to run?
[0] ScalaMainClass2
[1] ScalaMainClass1
[2] scripts.ScalaScript_sc
1

Afterwards, the --interactive flag does not have to be passed anymore.

▶ scala-cli .              
Found several main classes. Which would you like to run?
[0] ScalaMainClass2
[1] ScalaMainClass1
[2] scripts.ScalaScript_sc

Gedochao avatar Sep 01 '22 08:09 Gedochao

Unless you meant it should be turned on by default-by default. As in, that the choice should be presented even if the --interactive flag is never passed.

Which is something we can't really do, as there's a high probability that scala-cli is operated by a bot/automation rather than a human. So we wait for --interactive to be passed at least once, first.

Gedochao avatar Sep 01 '22 08:09 Gedochao

Well the beginner programmer might not know about the --interactive option. At least the error message of the multiple main class missing option should excplain how to use both --main-class and --interactive. Would that be ok?

bjornregnell avatar Sep 02 '22 19:09 bjornregnell

I have updated the initial description to include this proposed behavior. (I didn't think about the bot use case... but informative text doesn't bother bots :robot: )

bjornregnell avatar Sep 02 '22 19:09 bjornregnell

At least the error message of the multiple main class missing option should excplain how to use both --main-class and --interactive. Would that be ok?

Yeah, sure. This now looks like a duplicate of #1315, so let's track it there. Closing this ticket.

Gedochao avatar Sep 05 '22 06:09 Gedochao

oops. thanks keep repeating myself :blush:

bjornregnell avatar Sep 05 '22 06:09 bjornregnell