[Groovy] Class Main
- org.apache.groovy.groovysh.Main
class Main extends Object
A Main instance has a Groovysh member representing the shell, and a startGroovysh() method to run an interactive shell. Subclasses should preferably extend createIO() or configure the shell via getShell prior to invoking startGroovysh. Clients may use configureAndStartGroovysh to provide the same CLI params but a different Groovysh implementation (implementing getIO() and run()). The class also has static utility methods to manipulate the static ansi state using the jAnsi library. Main CLI entry-point for groovysh.
Properties Summary
Type | Name and description |
---|---|
Groovysh |
groovysh |
Constructor Summary
Constructor and description |
---|
Main
(IO io)
|
Main
(IO io, CompilerConfiguration configuration)
|
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
static void |
installAnsi() | |
static void |
main(String[] args) create a Main instance, configures it according to CLI arguments, and starts the shell. | |
static void |
setSystemProperty(String nameValue) | |
static void |
setTerminalType(String type, boolean suppressColor)
| |
protected void |
startGroovysh(String evalString, List<String> filenames)
|
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Property Detail
final Groovysh groovysh
Constructor Detail
Main(IO io)
- Parameters:
-
io:
- may just be new IO(), which is the default
Main(IO io, CompilerConfiguration configuration)
- Parameters:
-
io:
- may just be new IO(), which is the default
Method Detail
static void installAnsi()
static void main(String[] args)
create a Main instance, configures it according to CLI arguments, and starts the shell.
- Parameters:
-
main
- must have a Groovysh member that has an IO member.
@Deprecated static void setSystemProperty(String nameValue)
static void setTerminalType(String type, boolean suppressColor)
- Parameters:
-
type:
- one of 'auto', 'unix', ('win', 'windows'), ('false', 'off', 'none') -
suppressColor
- only has effect when ansi is enabled
protected void startGroovysh(String evalString, List<String> filenames)
- Parameters:
-
evalString
- commands that will be executed at startup after loading files given with filenames param -
filenames
- files that will be loaded at startup
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/apache/groovy/groovysh/Main.html