此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Shell 3.3.3! |
帮助
运行 shell 应用程序通常意味着用户处于图形受限的
环境。此外,虽然在手机时代我们几乎总是保持连接,
访问 Web 浏览器或任何其他富 UI 应用程序(如 PDF 查看器)可能并不总是
是可能的。这就是为什么 shell 命令必须正确地自记录很重要的原因,这就是help
命令进来。
打字help
+ ENTER
列出 shell 已知的所有命令(包括不可用的命令)
以及他们工作的简短描述,类似于以下内容:
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>
显示有关命令的更多详细信息,包括可用参数、其
类型、是否为必填项以及其他详细信息。
下面的清单显示了help
命令应用于自身:
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
您可以使用的位置enabled
要禁用命令,grouping-mode
取group
或flat
如果要通过拼合来隐藏组
a 结构,command-template
要定义命令帮助输出的模板,commands-template
定义
命令列表的输出。
如果spring.shell.command.help.grouping-mode=flat
设置,则 help 将显示:
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.
输出help
和help <commmand>
都使用默认实现进行模板化
可以更改。
选择spring.shell.command.help.commands-template
默认为classpath:template/help-commands-default.stg
并传递GroupsInfoModel
作为模型。
选择spring.shell.command.help.command-template
默认为classpath:template/help-command-default.stg
并传递CommandInfoModel
作为模型。
钥匙 | 描述 |
---|---|
|
|
|
commands 变量(请参阅 GroupCommandInfoModel 变量)。 |
|
commands 变量(请参阅 CommandInfoModel 变量)。 |
|
|
钥匙 | 描述 |
---|---|
|
组的名称(如果已设置)。否则为空。 |
|
命令 (如果已设置)。否则为空。Type 是多值,请参阅 CommandInfoModel 变量。 |
钥匙 | 描述 |
---|---|
|
命令的名称(如果已设置)。否则为 null。类型为 string 并包含 full 命令。 |
|
命令的名称(如果已设置)。否则为 null。类型本质上是多值 |
|
可能的别名(如果已设置)。类型是带字符串的多值。 |
|
命令的描述(如果已设置)。否则为 null。 |
|
parameters 变量(如果已设置)。否则为空。Type 是多值,请参阅 CommandParameterInfoModel 变量。 |
|
可用性变量(请参阅 CommandAvailabilityInfoModel 变量)。 |
钥匙 | 描述 |
---|---|
|
参数的类型(如果已设置)。否则为 null。 |
|
参数(如果已设置)。否则为 null。类型是带字符串的多值。 |
|
|
|
参数的描述 (如果已设置)。否则为 null。 |
|
参数的默认值 (如果已设置)。否则为 null。 |
|
|
钥匙 | 描述 |
---|---|
|
|
|
如果设置了 not available (如果已设置),则为原因。否则为 null。 |