[ENT-4483] - Make shell welcome message generic (#5758)

This commit is contained in:
Dimos Raptis 2019-11-25 17:09:47 +00:00 committed by Rick Parker
parent 21a075b727
commit 10e9340871
2 changed files with 6 additions and 16 deletions

View File

@ -183,7 +183,7 @@ object InteractiveShell {
"Commands to extract information about checkpoints stored within the node",
CheckpointShellCommand::class.java
)
shell = ShellLifecycle(configuration.commandsDirectory).start(config, configuration.user, configuration.password, runSshDaemon)
shell = ShellLifecycle(configuration.commandsDirectory).start(config, configuration.user, configuration.password)
}
fun runLocalShell(onExit: () -> Unit = {}) {
@ -211,7 +211,7 @@ object InteractiveShell {
}
class ShellLifecycle(private val shellCommands: Path) : PluginLifeCycle() {
fun start(config: Properties, localUserName: String = "", localUserPassword: String = "", runSshDaemon: Boolean): Shell {
fun start(config: Properties, localUserName: String = "", localUserPassword: String = ""): Shell {
val classLoader = this.javaClass.classLoader
val classpathDriver = ClassPathMountFactory(classLoader)
val fileDriver = FileMountFactory(Utils.getCurrentDirectory())
@ -237,8 +237,7 @@ object InteractiveShell {
return super.getPlugins().filterNot { it is JavaLanguage } + CordaAuthenticationPlugin(rpcOps)
}
}
val attributes = mutableMapOf<String, Any>()
attributes["crash.localShell"] = runSshDaemon
val attributes = emptyMap<String, Any>()
val context = PluginContext(discovery, attributes, commandsFS, confFS, classLoader)
context.refresh()
this.config = config

View File

@ -4,21 +4,12 @@ package net.corda.tools.shell.base
// given in the configuration code in InteractiveShell.
welcome = { ->
if (crash.context.attributes["crash.localShell"] == true) {
"""
"""
Welcome to the Corda interactive shell.
Useful commands include 'help' to see what is available, and 'bye' to exit the shell.
You can see the available commands by typing 'help'.
""".stripIndent()
} else {
"""
Welcome to the Corda interactive shell.
Useful commands include 'help' to see what is available, and 'bye' to shut down the node.
""".stripIndent()
}
""".stripIndent()
}
prompt = { ->