Skip to content

SI-9206 REPL custom bits#4576

Merged
SethTisue merged 6 commits intoscala:2.11.xfrom
som-snytt:issue/9206-more
Jul 1, 2015
Merged

SI-9206 REPL custom bits#4576
SethTisue merged 6 commits intoscala:2.11.xfrom
som-snytt:issue/9206-more

Conversation

@som-snytt
Copy link
Contributor

This supersedes #4447 and considers 2.11.x...iracic:topic/repl-customization--2nd-try

Introduces scala.repl.continue for continuation prompt, scala.shell.histfile for history file location, and scala.repl.welcome for its first impression, which is also available as a properties file entry, shell.welcome.

The welcome banner is turned off by setting it empty.

Review by @adriaanm the gaatkeeper.

@scala-jenkins scala-jenkins added this to the 2.11.8 milestone Jun 23, 2015
Anyone who doesn't understand why result printing was turned
off after they entered `:silent` mode will start the REPL
with `-Dscala.repl.debug` and be enlightened.

For infotainment purposes, the verbose message is also emitted
under info mode.
@adriaanm
Copy link
Contributor

You shall pass, once the build does!

@adriaanm
Copy link
Contributor

/cc @dragos since this checks of the first customization mentioned in #4563 (comment)

@som-snytt
Copy link
Contributor Author

It turns out that it's called BC test because it exists to make sure we're stuck in the Stone Age.

I accidentally enabled prop or alt which paulp somehow omitted from the trait. Commenting it out challenged my late-night gitfu.

Would also be nice if unit tests ran before BC. Usually BC is incidental and workaroundable, but failing tests are meaningful at least 50% of the time.

I'll work in a coffee break to get back to this today, in lieu of foosball.

@adriaanm
Copy link
Contributor

good point regarding the order of tests -- tracked as scala/scala-jenkins-infra#81

som-snytt and others added 3 commits June 23, 2015 15:52
Can be specified by `-Dscala.repl.welcome=Greeting` or in properties
file. It takes the same format arguments as the prompt, viz, version,
Java version and JVM name.

It can be disabled by `-Dscala.repl.welcome` with no text.
Specify it with -Dscala.shell.histfile=/path/to/file.
Because who doesn't want to customize their continuation prompt?

`scala -Dscala.repl.continue="..."` looks especially nice
with `-Dscala.color`.

Somewhat works when pasting, but the test rig for running a
transcript does not seek to support custom secondary prompts.
@som-snytt
Copy link
Contributor Author

OMG, it passed. Sorry it didn't make 2.11.7. Wink, wink.

@adriaanm
Copy link
Contributor

How about 2.11.7-1?

@som-snytt
Copy link
Contributor Author

Is there a 2.11.7-2015-06-23-2050?

@som-snytt
Copy link
Contributor Author

Does Jenkins, diligent though he may be, check that all authors have signed CLA or only the PR submitter?

Does he check whether the signator is just a shell corporation in the Cayman Islands?

@retronym
Copy link
Member

Looks like it is based on the PR submitter, not the commit author. That code also seems deficient with regards to the KYC principles of the anti-code-laundering regulators.

@som-snytt
Copy link
Contributor Author

hey, I didn't at-sign retronym, but he is one of my favorite Scala dads.

I wonder if he has a dog, because Friday is Take your dog to work day. I wonder if Miles Shapeless is aware of that. He must be.

@retronym
Copy link
Member

I think in his part of the world, that is statically overridden by the the spaniels' take-your-owner-to-the-rolling-green-hills friday.

Everyone knows that a `help` command will result in `more information`.

This commit moves the version string to the second line and adds some
verve to the welcome.

If anyone can't live without the old banner, they are now able to
configure it explicitly, so there is still no blood on our hands.
```
$ scala
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :quit
$ skala
Welcome to Scala!
version 2.11.7-20150623-155244-eab44dd092 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40).
Type in expressions for evaluation. Or try :help.

scala> :quit
```
REPL tests now lop off the actual length of the welcome header; or, if
necessary, remove the version number from a header embedded in output.
The welcome message defaults to a sober header followed by
one line of instructions.
@dragos
Copy link
Contributor

dragos commented Jun 26, 2015

Looks good as far as I'm concerned.

@som-snytt
Copy link
Contributor Author

I might go retro.

$ /media/Software/scala-2.5.1-final/share/scala/bin/scala
This is a Scala shell.
Type in expressions to have them evaluated.
Type :help for more information.

@adriaanm
Copy link
Contributor

adriaanm commented Jul 1, 2015

I'd drop articles.

@SethTisue
Copy link
Member

LGTM. @adriaanm, not sure if your comment is a joke I'm missing, or what.

@som-snytt
Copy link
Contributor Author

$ scala
это Скала оболочка.

@adriaanm
Copy link
Contributor

adriaanm commented Jul 1, 2015

Yep, silly jokes is my middle name.

@som-snytt
Copy link
Contributor Author

Where others use grep, Adriaan uses grap.

@adriaanm
Copy link
Contributor

adriaanm commented Jul 1, 2015

(How would a group nap help us find anything? Oh wait, I'm losing my dutch!)

SethTisue added a commit that referenced this pull request Jul 1, 2015
@SethTisue SethTisue merged commit 495fdb8 into scala:2.11.x Jul 1, 2015
@iracic
Copy link

iracic commented Oct 14, 2015

I have just tested with scala-2.11.8-d792e35-nightly.tgz.
-Dscala.shell.histfile histfile relocated. OK
-Dscala.shell.welcome welcome customized. OK
-Dscala.shell.prompt PS1 prompt set.OK
-Dshell.repl.info quite verbosity change. OK

Option -Dscala.repl.continue is taken into account but also prepended with two spaces.
For -Dscala.repl.continue="> " (no leading spaces), it adds 2 spaces indentation
(can't get formatting correctly here, hopefully point is clear)

Thank you for your work on these points.
Regards,
Igor

@som-snytt
Copy link
Contributor Author

@iracic the code comment says continue prompt is adjusted for your primary prompt. So the code lines up.

https://github.com/scala/scala/blob/v2.12.0-M3/src/repl/scala/tools/nsc/interpreter/ReplProps.scala#L51

@iracic
Copy link

iracic commented Oct 14, 2015

Personally I do not see the need for such rule.

@som-snytt
Copy link
Contributor Author

The idea was that the common use case is to set the primary prompt and see aligned output. Dynamic prompts are any length.

I could see not aligning if both prompts are user-supplied. Or a different flag for it. Maybe ask on gitter and create an issue.

@iracic
Copy link

iracic commented Oct 15, 2015

Thanks again for pushing this stuff forward.

@som-snytt som-snytt deleted the issue/9206-more branch October 25, 2015 08:02
@som-snytt
Copy link
Contributor Author

So Ammonite has the bang from my original edit! No wonder everyone loves Ammonite!

Welcome to the Ammonite Scala REPL!

@som-snytt som-snytt restored the issue/9206-more branch June 26, 2020 20:47
@som-snytt som-snytt deleted the issue/9206-more branch December 19, 2020 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants