There seems to be a lot of options for configuring JShell feedback mode and prompt, as well as the ability to pre-define presets, and to save them between sessions. However, what I want is to print an "initializing" message using a --startup script, but only when using normal feedback mode.
When using normal mode, I want the message to be displayed:
$ echo 'println(myApp.whoami())' | jshell --startup PRINTING --startup init.jsh -
Initializing JShell for MyApplication...
Ready.
root
But when using concise mode, like when you start JShell with the -q option, I want the initialize message to be suppressed:
$ echo 'println(myApp.whoami())' | jshell --startup PRINTING --startup init.jsh -q -
root
I spent quite a bit of time looking at the options for /set, but could not find anything that worked. I tried searching for a way to detect the current mode to use it in an if statement in the initialization script, but I can only find a way to set it, not to get it. I also tried finding a system property that had information about the mode, but there wasn't any. I also tried with, and without, the --startup PRINTING option (using System.{out|err} for the messages instead).