Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picocli-based Groovy CliBuilder alternative #258

Closed
remkop opened this issue Jan 5, 2018 · 3 comments
Closed

Picocli-based Groovy CliBuilder alternative #258

remkop opened this issue Jan 5, 2018 · 3 comments
Milestone

Comments

@remkop
Copy link
Owner

remkop commented Jan 5, 2018

With the new picocli 3.0 programmatic API it should be possible to create a groovy DSL that is (or almost is) a drop-in for CliBuilder, with additional benefits:

  • support for subcommands
  • support for strongly typed positional parameters
  • support for mixins for reuse
  • automatic help (remove boilerplate)
  • ANSI colors in usage help
  • groovy application command line autocompletion
@remkop remkop added this to the 3.0 milestone Jan 5, 2018
@remkop remkop changed the title Picocli-based groovy.CliBuilder alternative DSL Picocli-based groovy.CliBuilder alternative Jan 5, 2018
@remkop remkop changed the title Picocli-based groovy.CliBuilder alternative Picocli-based Groovy CliBuilder alternative Mar 25, 2018
@remkop
Copy link
Owner Author

remkop commented Mar 25, 2018

The Groovy community is positive about this idea.
See https://issues.apache.org/jira/browse/GROOVY-8520

@remkop
Copy link
Owner Author

remkop commented Mar 30, 2018

h3. Mapping commons.cli.CommandLine methods to ParseResult methods

List<String>	getArgList() 	List<String>	unmatched()
String[]	getArgs() 		unmatched()
Object	getOptionObject(char opt)  [DEPRECATED]		
Object	getOptionObject(String opt)   [DEPRECATED]		
Properties	getOptionProperties(Option option) 		
Properties	getOptionProperties(String opt) 		
Option[]	getOptions() 	List<OptionSpec>	options()
String	getOptionValue(char opt) 	String	rawOptionValue(char shortName)
String	getOptionValue(char opt, String defaultValue) 	String	rawOptionValue(char shortName, java.lang.String defaultValue)
String	getOptionValue(Option option) 	String	rawOptionValue(CommandLine.Model.OptionSpec option)
String	getOptionValue(Option option, String defaultValue) 	String	rawOptionValue(CommandLine.Model.OptionSpec option, java.lang.String defaultValue)
String	getOptionValue(String opt) 	String	rawOptionValue(java.lang.String name)
String	getOptionValue(String opt, String defaultValue) 	String	rawOptionValue(java.lang.String name, java.lang.String defaultValue)
String[]	getOptionValues(char opt) 	List<String>	rawOptionValues(char shortName)
String[]	getOptionValues(Option option) 	List<String>	rawOptionValues(CommandLine.Model.OptionSpec option)
String[]	getOptionValues(String opt) 	List<String>	rawOptionValues(java.lang.String name)
Object	getParsedOptionValue(char opt) 	<T> T	optionValue(char shortName, T defaultValue)
Object	getParsedOptionValue(Option option) 	<T> T	optionValue(CommandLine.Model.OptionSpec option, T defaultValue)
Object	getParsedOptionValue(String opt) 	<T> T	optionValue(java.lang.String name, T defaultValue)
boolean	hasOption(char opt) 	boolean	hasOption(char shortName)
boolean	hasOption(Option opt) 	boolean	hasOption(CommandLine.Model.OptionSpec option)
boolean	hasOption(String opt) 	boolean	hasOption(java.lang.String name)
Iterator<Option>	iterator() 	List<OptionSpec>	options()
			
			
-	-	boolean	hasPositional(CommandLine.Model.PositionalParamSpec positional)
-	-	boolean	hasPositional(int position)
-	-	boolean	hasSubcommand()
-	-	boolean	isUsageHelpRequested()
-	-	boolean	isVersionHelpRequested()
-	-	CommandLine.Model.OptionSpec	option(char shortName)
-	-	CommandLine.Model.OptionSpec	option(java.lang.String name)
-	-	java.util.List<java.lang.String>	originalArgs()
-	-	CommandLine.Model.PositionalParamSpec	positional(int position)
-	-	java.util.List<CommandLine.Model.PositionalParamSpec>	positionalParams()
-	-	<T> T	positionalValue(CommandLine.Model.PositionalParamSpec positional, T defaultValue)
-	-	<T> T	positionalValue(int position, T defaultValue)
-	-	java.lang.String	rawPositionalValue(int position)
-	-	java.lang.String	rawPositionalValue(int position, java.lang.String defaultValue)
-	-	CommandLine.ParseResult	subcommand()

@remkop
Copy link
Owner Author

remkop commented Apr 30, 2018

Closing this ticket since apache/groovy#688 has been merged into the Groovy codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant