Uploaded image for project: 'Spring Shell'
  1. Spring Shell
  2. SHL-181

Allow CLI option definition on parameter object

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 2.0 M1
    • Component/s: None
    • Labels:
      None

      Description

      It would be useful if you could specify CLI options on a parameter object of the CLI command.
      Currently all options need to be parameters of the command method. This becomes unwieldy if you have a lot of options.

      Imagine something like this:

      @CliCommand(value = "ping-server", help = "Send ICMP ECHO_REQUEST to network hosts")
      public void ping(@CliOptions PingOptions pingOptions) {
      	...
      }
      
      public class PingOptions {
      
      	@CliOption(key = "a", mandatory = false, help = "Audible ping", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true")
      	private boolean audiblePing;
      
      	@CliOption(key = "i", mandatory = false, help = "Wait  interval  seconds  between  sending each packet.", unspecifiedDefaultValue = "1", specifiedDefaultValue = "1")
      	private int interval; 
      
      	...	
      }
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            klr8 Erwin Vervaet
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: