Author: pidster
Date: Sat Jun 4 23:25:03 2011
New Revision: 1131502
URL: http://svn.apache.org/viewvc?rev=1131502&view=rev
Log:
Fix blunders in main method
Modified:
incubator/kitty/sandbox/trunk/agent/ (props changed)
incubator/kitty/sandbox/trunk/groovy1.8/ (props changed)
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Kitty.groovy
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Main.groovy
Propchange: incubator/kitty/sandbox/trunk/agent/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jun 4 23:25:03 2011
@@ -0,0 +1 @@
+build
Propchange: incubator/kitty/sandbox/trunk/groovy1.8/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jun 4 23:25:03 2011
@@ -0,0 +1 @@
+build
Modified:
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Kitty.groovy
URL:
http://svn.apache.org/viewvc/incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Kitty.groovy?rev=1131502&r1=1131501&r2=1131502&view=diff
==============================================================================
---
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Kitty.groovy
(original)
+++
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Kitty.groovy
Sat Jun 4 23:25:03 2011
@@ -42,14 +42,14 @@ class Kitty {
this.dispatcher = new Dispatcher(shell: kittyShell, commands:
commands)
this.dispatcher.metaClass = emc
- this.addShutdownHook { -> this.close() }
+ this.addShutdownHook { -> close() }
}
- def runConsole(String[] initial) {
+ def runConsole(initial) throws KittyException {
// TODO handle additional initial args
- kittyShell.display "${TITLE:'####### Apache Kitty (TEST MODE)'}
${VERSION:'v0.0'} #######"
+ kittyShell.display "${TITLE ?: '####### Apache Kitty (TEST
MODE)'} ${VERSION ?: 'v0.0 #######'}"
kittyShell.display " "
while (running) {
@@ -69,17 +69,13 @@ class Kitty {
catch (KittyRuntimeException e) {
kittyShell.error e.getMessage()
}
- catch (KittyException e) {
- kittyShell.error e.getMessage()
- }
catch (Exception e) {
- e.printStackTrace()
- close()
+ throw new KittyException(e)
}
}
}
- def runCommand(String[] line) throws KittyRuntimeException {
+ def runCommand(line) throws KittyException, KittyRuntimeException {
try {
// strip first and use the rest as args
@@ -89,7 +85,7 @@ class Kitty {
// Use spread operator to split args
dispatcher."$command"(*arguments)
}
- catch (Exception e) {
+ catch (RuntimeException e) {
throw new KittyRuntimeException(e)
}
}
Modified:
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Main.groovy
URL:
http://svn.apache.org/viewvc/incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Main.groovy?rev=1131502&r1=1131501&r2=1131502&view=diff
==============================================================================
---
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Main.groovy
(original)
+++
incubator/kitty/sandbox/trunk/groovy1.8/src/main/groovy/org/apache/kitty/Main.groovy
Sat Jun 4 23:25:03 2011
@@ -22,8 +22,11 @@ class Main {
return
}
+ println "cli: $cli"
+ println "opt: $opt"
+
def func = (opt?.s) ? 'runCommand' : 'runConsole'
- new Kitty()."$func"(opt.args)
+ new Kitty()."$func"(opt.arguments())
}
def static usage(cli) {