-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Variables and scripts tab completion
- Loading branch information
Showing
7 changed files
with
146 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
// HELP_END | ||
import org.jline.builtins.SystemRegistry | ||
import org.jline.builtins.Options; | ||
|
||
class HelloWorld { | ||
static void hello(def who) { | ||
println "hello $who!" | ||
static void hello(def args) { | ||
String[] usage = [ | ||
"hello - test groovy script", | ||
"Usage: hello [NAME]", | ||
" -? --help Displays command help", | ||
" --hi Says hello", | ||
] | ||
Options opt = Options.compile(usage).parse(args) | ||
if (opt.isSet("help")) { | ||
throw new Options.HelpException(opt.usage()) | ||
} | ||
if (opt.isSet('hi')) { | ||
def who = opt.args().getAt(0) == null ? 'world' : opt.args().getAt(0) | ||
println "hello $who!" | ||
} | ||
def map = [user:'pippo',age:10] | ||
SystemRegistry.get().invoke('prnt', '-s', 'JSON', map) | ||
} | ||
} | ||
|
||
def static main(def _args){ | ||
HelloWorld.hello(!_args ? 'world' : _args[0]) | ||
HelloWorld.hello(_args) | ||
return 'just testing...' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# test console script | ||
# HELP_END | ||
import org.jline.utils.* | ||
|
||
println "Is Windows: " + OSUtils.IS_WINDOWS | ||
|