/
cmd_jshell.go
44 lines (39 loc) · 1.19 KB
/
cmd_jshell.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* Copyright (c) 2023, Oracle and/or its affiliates.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
package runner
import (
v1 "github.com/oracle/coherence-operator/api/v1"
"github.com/spf13/cobra"
"os"
)
const (
// CommandJShell is the argument to launch a JShell console.
CommandJShell = "jshell"
)
// queryPlusCommand creates the corba "jshell" sub-command
func jShellCommand() *cobra.Command {
return &cobra.Command{
Use: CommandJShell,
Short: "Start a Coherence interactive JShell console",
Long: "Starts a Coherence interactive JShell console",
Args: cobra.ArbitraryArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return run(cmd, jShell)
},
}
}
// Configure the runner to run a Coherence JShell console
func jShell(details *RunDetails, _ *cobra.Command) {
details.Command = CommandQueryPlus
details.AppType = AppTypeJava
details.MainClass = "jdk.internal.jshell.tool.JShellToolProvider"
if len(os.Args) > 2 {
details.MainArgs = os.Args[2:]
}
details.addArg("-Dcoherence.distributed.localstorage=false")
details.setenv(v1.EnvVarCohRole, "jshell")
details.unsetenv(v1.EnvVarJvmMemoryHeap)
}