此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Shell 3.3.3spring-doc.cadn.net.cn

命令上下文

CommandContextinterface 允许访问当前正在运行的 上下文。您可以使用它来访问选项:spring-doc.cadn.net.cn

String arg = ctx.getOptionValue("arg");

如果你需要将某些东西打印到 shell 中,你可以获取一个Terminal并使用它的 writer 打印一些东西:spring-doc.cadn.net.cn

ctx.getTerminal().writer().println("hi");

APP信息