spring-projects / spring-shell

Spring based shell
http://projects.spring.io/spring-shell/
Apache License 2.0
723 stars 395 forks source link

Support arg=value format with options #979

Open Martiul opened 7 months ago

Martiul commented 7 months ago

Hello,

I recently upgraded from spring-shell 2.7.5 to 3.2.0, and found that arguments of the form "arg=value" are no longer accepted.

Is this a regression, or was it intended?

Sample code:

  @ShellMethod(
      value = "Description",
      key = {"test"})
  public void test(
      @ShellOption(
          value = {"--foo", "-f"},
          defaultValue = ShellOption.NULL) String foo) {
    System.out.println("Foo is: " + foo);
  }

shell:> test --foo=bar

Expected:

Foo is: bar

Actual:

Unrecognised option '--foo=bar'
jvalkeal commented 7 months ago

Thanks for pointing this out. It wasn't implemented when parser infra went through complete overhaul.

I'm just thinking that when we add support for this should we be explicit which formats are supported, --arg value vs. --arg=value. It might be convenient to allow user to choose either or both.

Martiul commented 7 months ago

Thanks for the response @jvalkeal . For me specially, this is not a blocking/urgent bug, but figured it was worth mentioning in case other users do the same migration