This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Groovy and the fly likes groovy with apache cli - incorrect parsing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "groovy with apache cli - incorrect parsing" Watch "groovy with apache cli - incorrect parsing" New topic
Author

groovy with apache cli - incorrect parsing

Maciej Opala
Ranch Hand

Joined: Jul 18, 2011
Posts: 38
Hi,

I need to write a command line script in groovy and here's the first attempt (test of course ;]):

When I invoke the script with 'groovy bs.groovy' the following message is displayed:

error: Missing required option: v
usage: usage TODO
-h,--help usage information
-v,--version <version> global version settings
No options entered!
usage: usage TODO
-h,--help usage information
-v,--version <version> global version settings


Is it possible to catch the situation where no options are entered? In such case I'd just like to display the usage info.

Also when the script is invoked with 'groovy bs.groovy -h' the same error messages is displayed. How to prevent parsing when 'help' option is present? In such case I'd like to display the usage info (ignoring the rest of options) and exit.

Any help would be greatly appreciated.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: groovy with apache cli - incorrect parsing
 
Similar Threads
help to edit to run this program
Running JBoss Project in Debug Mode
apache commons-cli how to have help coexist with a required parameter?
mysql database restore
Critique Please