groovy.ui
Class GroovyMain

A Command line to execute groovy.

author:
Jeremy Rayner
author:
Yuri Schimke
version:
$Revision: 10602 $

Field Summary
 List args
           
 boolean autoOutput
           
 boolean autoSplit
           
 String backupExtension
           
 CompilerConfiguration conf
           
 boolean debug
           
 boolean editFiles
           
 boolean isScriptFile
           
 int port
           
 boolean processFiles
           
 boolean processSockets
           
 String script
           
 String splitPattern
           
 
Constructor Summary
GroovyMain()
           
 
Method Summary
static Options buildOptions()
           Build the options parser.
File huntForTheScriptFile(String input)
           Hunt for the script file, doesn't bother if it is named precisely.
static void main(def args)
           Main CLI interface.
static CommandLine parseCommandLine(Options options, def args)
           Parse the command line.
static void printHelp(PrintStream out, Options options)
          
static boolean process(CommandLine line)
           Process the users request.
static void processArgs(def args, PrintStream out)
          
void processFile(Script s, File file)
           Process a single input file.
void processFiles()
           Process the input files.
void processOnce()
           Process the standard, single script with args.
void processReader(Script s, BufferedReader reader, PrintWriter pw)
           Process a script against a single input file.
void processSockets()
           Process Sockets.
boolean run()
           Run the script.
static void setSystemPropertyFrom(String nameValue)
          
 

Constructor Detail

GroovyMain

GroovyMain()


Method Detail

buildOptions

static Options buildOptions()
Build the options parser. Has to be synchronized because of the way Options are constructed.
return:
an options parser.


huntForTheScriptFile

public File huntForTheScriptFile(String input)
Hunt for the script file, doesn't bother if it is named precisely. Tries in this order: - actual supplied name - name.groovy - name.gvy - name.gy - name.gsh


main

public static void main(def args)
Main CLI interface.
param:
args all command line args.


parseCommandLine

static CommandLine parseCommandLine(Options options, def args)
Parse the command line.
param:
options the options parser.
param:
args the command line args.
return:
parsed command line.
throws:
ParseException if there was a problem.


printHelp

static void printHelp(PrintStream out, Options options)


process

static boolean process(CommandLine line)
Process the users request.
param:
line the parsed command line.
throws:
ParseException if invalid options are chosen


processArgs

public static void processArgs(def args, PrintStream out)


processFile

void processFile(Script s, File file)
Process a single input file.
param:
s the script to execute.
param:
file the input file.


processFiles

void processFiles()
Process the input files.


processOnce

void processOnce()
Process the standard, single script with args.


processReader

void processReader(Script s, BufferedReader reader, PrintWriter pw)
Process a script against a single input file.
param:
s script to execute.
param:
reader input file.
param:
pw output sink.


processSockets

void processSockets()
Process Sockets.


run

boolean run()
Run the script.


setSystemPropertyFrom

static void setSystemPropertyFrom(String nameValue)