帮助

运行shell应用通常意味着用户处于图形限制范围内 环境。这就是为什么 shell 命令必须正确自文档化,这也是帮助指挥部进来了。spring-doc.cadn.net.cn

打字帮助 + 进入列出壳体已知的所有命令(包括不可用的命令) 以及对其职能的简要描述,类似于以下内容:spring-doc.cadn.net.cn

my-shell:>help
AVAILABLE COMMANDS

Built-In Commands
       exit: Exit the shell.
       help: Display help about available commands
       stacktrace: Display the full stacktrace of the last error.
       clear: Clear the shell screen.
       quit: Exit the shell.
       history: Display or save the history of previously run commands
       completion bash: Generate bash completion script
       version: Show version info
       script: Read and execute commands from a file.

打字Help <command>显示命令的更详细信息,包括可用的参数,以及 类型、是否强制,以及其他细节。spring-doc.cadn.net.cn

以下列表显示了帮助命令对自身施加:spring-doc.cadn.net.cn

my-shell:>help help
NAME
       help - Display help about available commands

SYNOPSIS
       help --command String

OPTIONS
       --command or -C String
       The command to obtain help for.
       [Optional]

帮助是模板化的,必要时可以进行定制。设置在下面spring.shell.command.help你可以在哪里使用启用为了禁用指令,分组模式夺取如果你想通过平整来隐藏群组 一个结构,命令模板为了定义命令输出模板,帮助,命令模板定义 命令列表的输出。spring-doc.cadn.net.cn

如果spring.shell.command.help.grouping-mode=flat设置好后,帮助将显示:spring-doc.cadn.net.cn

my-shell:>help help
AVAILABLE COMMANDS

exit: Exit the shell.
help: Display help about available commands
stacktrace: Display the full stacktrace of the last error.
clear: Clear the shell screen.
quit: Exit the shell.
history: Display or save the history of previously run commands
completion bash: Generate bash completion script
version: Show version info
script: Read and execute commands from a file.

输出来自帮助帮助<commmand>两者都采用了默认实现模板 这些都可以更改。spring-doc.cadn.net.cn

选择spring.shell.command.help.commands-template默认为classpath:template/help-commands-default.stg且通过GroupsInfoModel作为模特。spring-doc.cadn.net.cn

选择spring.shell.command.help.command-template默认为classpath:template/help-command-default.stg且通过命令信息模型作为模特。spring-doc.cadn.net.cn

表1。GroupsInfoModel 变量
钥匙 描述

演出团体spring-doc.cadn.net.cn

true如果显示分组已启用。否则,就是错误的。spring-doc.cadn.net.cn

spring-doc.cadn.net.cn

命令变量(参见 GroupCommandInfoModel 变量)。spring-doc.cadn.net.cn

命令spring-doc.cadn.net.cn

命令变量(参见 CommandInfoModel 变量)。spring-doc.cadn.net.cn

hasUnavailableCommandsspring-doc.cadn.net.cn

true如果有不可用的命令。否则,就是错误的。spring-doc.cadn.net.cn

表2。GroupCommandInfoModel 变量
钥匙 描述

spring-doc.cadn.net.cn

如果已设置,则为组名。否则,空无一物。spring-doc.cadn.net.cn

命令spring-doc.cadn.net.cn

命令,如果设置好。否则,空无一物。类型是多值,详见 CommandInfoModel 变量。spring-doc.cadn.net.cn

表3。CommandInfoModel 变量
钥匙 描述

名称spring-doc.cadn.net.cn

如果设置了命令名称。否则,无效。类型是字符串,包含完整命令。spring-doc.cadn.net.cn

名称spring-doc.cadn.net.cn

如果设置了命令的名称。否则,无效。类型本质上是多值的名称分裂。spring-doc.cadn.net.cn

别名spring-doc.cadn.net.cn

如果设置了,可能的别名。类型是多值,包含字符串。spring-doc.cadn.net.cn

描述spring-doc.cadn.net.cn

如果设置了命令的描述。否则,无效。spring-doc.cadn.net.cn

参数spring-doc.cadn.net.cn

参数变量,如果已设置。除此之外,空无一物。类型是一个多值,参见 CommandParameterInfoModel 变量。spring-doc.cadn.net.cn

可用性spring-doc.cadn.net.cn

可用性变量(参见 CommandAvailabilityInfoModel 变量)。spring-doc.cadn.net.cn

表4。CommandParameterInfoModel 变量
钥匙 描述

类型spring-doc.cadn.net.cn

参数类型如果设置为。否则,无效。spring-doc.cadn.net.cn

参数spring-doc.cadn.net.cn

论点,如果成立。否则,无效。类型是多值,包含字符串。spring-doc.cadn.net.cn

必填spring-doc.cadn.net.cn

true如果需要的话。否则,就是错误的。spring-doc.cadn.net.cn

描述spring-doc.cadn.net.cn

参数的描述,如果设定。否则,无效。spring-doc.cadn.net.cn

defaultValuespring-doc.cadn.net.cn

参数的默认值,如果设置为。否则,无效。spring-doc.cadn.net.cn

hasDefaultValuespring-doc.cadn.net.cn

true如果defaultValue存在。否则,就是错误的。spring-doc.cadn.net.cn

表5。CommandAvailabilityInfoModel 变量
钥匙 描述

可用spring-doc.cadn.net.cn

true如果有的话。否则,就是错误的。spring-doc.cadn.net.cn

原因spring-doc.cadn.net.cn

如果原因无法获得,且已设定。否则,无效。spring-doc.cadn.net.cn