Single Command

如果你的 shell 应用程序只能用于单一目的,并且只有一个命令,可能需要为其进行配置。如果定义了属性 spring.shell.noninteractive.primary-command,将禁用 NonInteractiveShellRunner 以外的所有其他运行器,并将其配置为使用已定义的 Primary Command

If your shell application is made for exactly a single purpose having only one command it may be beneficial to configure it for this. Property spring.shell.noninteractive.primary-command if defined will disable all other runners than NonInteractiveShellRunner and configures it to use defined Primary Command.

spring:
  shell:
    noninteractive:
      primary-command: mycommand

例如,如果你有一个带选项 arg 的命令 mycommand,它必须使用 <shellapp> mycommand --arg hi 执行,但是,通过上述设置,可以使用 <shellapp> --arg hi 执行它。

For example if you have a command mycommand with option arg it had to be executed with <shellapp> mycommand --arg hi, but with above setting it can be executed with <shellapp> --arg hi.