命令上下文

CommandContext 接口提供对当前运行上下文的访问。您可以使用它来访问选项

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

如果您需要向 shell 打印内容,您可以获取一个 Terminal 并使用其写入器来打印内容

ctx.getTerminal().writer().println("hi");
© . This site is unofficial and not affiliated with VMware.