Path Input

路径输入组件要求用户提供 Path,并提供有关路径自身的其他信息。

Unresolved include directive in modules/ROOT/pages/components/ui/pathinput.adoc - include::../../../../../src/test/java/org/springframework/shell/docs/UiComponentSnippets.java[]

以下屏幕截图展示了路径输入组件的典型输出:

{"version": 2, "width": 85, "height": 6, "timestamp": 1645645867, "env": {"SHELL": "/bin/bash", "TERM": "xterm-256color"}}
[1.276071, "o", "java -jar spring-shell-sample-commands.jar"]
[1.975169, "o", "\r\n"]
[3.730642, "o", "\u001b[?1h\u001b=\u001b[?2004h\u001b[33mmy-shell:>\u001b[0m"]
[4.157171, "o", "\u001b[31mc\u001b[0m"]
[4.259876, "o", "\u001b[31mo\u001b[0m"]
[4.480644, "o", "\u001b[31mm\u001b[0m"]
[4.675743, "o", "\u001b[31mp\u001b[0m"]
[4.746389, "o", "\u001b[31mo\u001b[0m"]
[4.899817, "o", "\u001b[31mn\u001b[0m"]
[5.064803, "o", "\u001b[31me\u001b[0m"]
[5.151957, "o", "\u001b[31mn\u001b[0m"]
[5.295573, "o", "\u001b[31mt\u001b[0m"]
[5.626209, "o", "\u001b[31m \u001b[0m"]
[5.949778, "o", "\u001b[31mp\u001b[0m"]
[6.052068, "o", "\u001b[31ma\u001b[0m"]
[6.270888, "o", "\u001b[31mt\u001b[0m"]
[6.342701, "o", "\u001b[13D\u001b[1mcomponent path\u001b[0m\u001b[K"]
[6.866598, "o", "\r\r\n\u001b[?1l\u001b>\u001b[?1000l\u001b[?2004l"]
[6.918336, "o", "\u001b[?1h\u001b=\u001b[?25l"]
[6.979593, "o", "\u001b[32;1m?\u001b[0m \u001b[97;1mEnter value\u001b[0m \r"]
[8.74751, "o", "\u001b[14C/\u001b[88C \u001b[31m>\u001b[0m\u001b[31m>>\u001b[0m \u001b[31mDirectory exists\u001b[0m\u001b[A\r"]
[10.825765, "o", "\u001b[15Ct\r\r\n\u001b[32m>\u001b[0m \u001b[32mPath ok\u001b[0m\u001b[K\u001b[A\r"]
[10.96141, "o", "\u001b[16Cm\r"]
[11.050615, "o", "\u001b[17Cp\r\r\n\u001b[31m>>>\u001b[0m \u001b[31mDirectory exists\u001b[0m\u001b[K\u001b[A\r"]
[11.812886, "o", "\u001b[18C/\r"]
[11.930461, "o", "\u001b[19Cd\r\r\n\u001b[32m>\u001b[0m \u001b[32mPath ok\u001b[0m\u001b[K\u001b[A\r"]
[12.128981, "o", "\u001b[20Ce\r"]
[12.176119, "o", "\u001b[21Cm\r"]
[12.28765, "o", "\u001b[22Co\r"]
[13.464196, "o", "\u001b[?1l\u001b>\u001b[?12;25h\u001b[K\r\r\n\u001b[K\u001b[A"]
[13.471408, "o", "\u001b[32;1m?\u001b[0m \u001b[97;1mEnter value\u001b[0m \u001b[34m/tmp/demo\u001b[0m\r\n"]
[13.471875, "o", "Got value /tmp/demo\r\n"]
[13.475016, "o", "\u001b[?1h\u001b=\u001b[?2004h\u001b[33mmy-shell:>\u001b[0m"]
[15.475016, "o", "\u001b[?1h\u001b=\u001b[?2004h\u001b[33mmy-shell:>\u001b[0m"]

上下文对象是 PathInputContext。以下表格描述了它的上下文变量:

Table 1. PathInputContext Template Variables
Key Description

model

父上下文变量(请参阅 TextComponentContext Template Variables)。