命令上下文

CommandContext 介面提供對當前執行上下文的訪問。您可以使用它來訪問選項

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

如果您需要向 shell 列印內容,您可以獲取一個 Terminal 並使用其寫入器來列印內容

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