UiPath Documentation
uipath-cli
latest
false
重要 :
请注意,此内容已使用机器翻译进行了本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

UiPath CLI 用户指南

全局选项

无论使用何种工具或子命令,每次uip调用都会识别四个选项。它们控制输出格式、输出筛选器和日志流。所有其他标志均根据命令进行定义。

选项默认用途
--outputtablejsonyamlplainjson写入标准输出的主要输出格式。
--output-filterJMES 路径表达式在格式化之前,对 JSON 有效负载应用后置筛选器。
--log-leveldebuginfowarnerrorinfo写入 标准derr 的日志消息的详细信息(和--log-file ,如果已设置)。
--log-file路径如果设置,则日志将以 JSON 行格式复制到此文件中。

--version ( -v ) 和--help ( -h ) 也可以在uip和 Everyone 子命令上识别,但它们是标准 CLI 约定,而不是上述意义上的全局标志。

--输出

选择输出格式。--output json--output=json均可运行;值区分大小写。

uip or folders list                  # default: json
uip or folders list --output table   # human-friendly table
uip or folders list --output yaml    # yaml
uip or folders list --output plain   # key=value lines, no structure
uip or folders list                  # default: json
uip or folders list --output table   # human-friendly table
uip or folders list --output yaml    # yaml
uip or folders list --output plain   # key=value lines, no structure
  • json (默认)— 标准输出上的一个 JSON 文档。可由jq--output-filter和任何 JSON 使用者解析。无论终端是否为 TTY,这是每次调用的默认设置。
  • table — 适合在终端中阅读的有边框彩色表格。跨版本不稳定 — 请勿解析。
  • yaml — 结构与json相同的 YAML 序列化。
  • plain — 展平key=value行。用于在无需安装readgrepcut jq情况下连接到 shell 。
备注:

默认值为json ,而不是table 。当人工在终端中运行uip or folders list时,他们会在标准输出上看到 JSON 文档。为便于读取的视图,显式传递--output table (或将其添加到 Shell 别名中)。此选择可在终端和管道中保持相同的标准输出形状 — 脚本无需关心它们是否在以交互方式运行。

流分离

--output仅控制标准输出。无论格式如何,日志、进度指示器和面向人的错误都将发送到标准错误 (stderr) 。这意味着管道可以通过以下方式捕获干净的 JSON:

uip or folders list > folders.json 2> uip.log
uip or folders list > folders.json 2> uip.log

…并且仍会单独查看日志输出。

--输出筛选器

在格式化 JSON 有效负载之前,对 JMESPath 表达式应用JMESPath表达式。筛选器在完整响应信封上运行,因此Data[*].NameData数组中选取名称, length(Data)返回计数,依此类推。

# just the Data field
uip or folders list --output-filter "Data"

# folder names only
uip or folders list --output-filter "Data[*].Name"

# count
uip or folders list --output-filter "length(Data)"

# first folder's key and name
uip or folders list --output-filter "Data[0] | {key: Key, name: Name}"
# just the Data field
uip or folders list --output-filter "Data"

# folder names only
uip or folders list --output-filter "Data[*].Name"

# count
uip or folders list --output-filter "length(Data)"

# first folder's key and name
uip or folders list --output-filter "Data[0] | {key: Key, name: Name}"

--output结合使用:

# names as YAML
uip or folders list --output-filter "Data[*].Name" --output yaml

# names as one-per-line plain text
uip or folders list --output-filter "Data[*].Name" --output plain
# names as YAML
uip or folders list --output-filter "Data[*].Name" --output yaml

# names as one-per-line plain text
uip or folders list --output-filter "Data[*].Name" --output plain

格式错误的筛选器表达式会快速失败,并在基础命令运行前显示ValidationError退出代码 3 — 因此,即使是输入错误,也不会浪费一次 API 调用。

提示:

--output-filter是 Azure CLI 的--query 、AWS CLI 的--query和 gcloud 的--filter / --format的 CLI 版本。如果您已经知道这些工具中的 JMESPath,则语法是相同的。

--日志级别

设置日志消息的详细程度(写入 STderr 和--log-file ,如果提供)。

uip or folders list --log-level debug   # verbose — HTTP calls, auth refresh, tool loading
uip or folders list --log-level info    # default
uip or folders list --log-level warn
uip or folders list --log-level error   # only failures
uip or folders list --log-level debug   # verbose — HTTP calls, auth refresh, tool loading
uip or folders list --log-level info    # default
uip or folders list --log-level warn
uip or folders list --log-level error   # only failures

值不区分大小写。系统会静默忽略未知值(保留默认值),而不是有意出错,因此包装器脚本中的拼写错误不会中断管道。

不使用UIPATH_LOG_LEVEL环境变量;传递标志或在配置文件脚本中进行设置。

--日志文件

以 JSON 行格式(每行一个 JSON 对象)将日志流的副本写入指定文件。系统已附加文件 — 如果每次运行都需要单独的日志,请使用特定于内部版本的路径。

uip or folders list --log-file ./uip.log
uip or folders list --log-file /var/log/uip/$(date +%F).log --log-level debug
uip or folders list --log-file ./uip.log
uip or folders list --log-file /var/log/uip/$(date +%F).log --log-level debug

文件中的每一行如下所示:

{"time":"2026-04-24T18:42:00.123Z","level":"info","message":"CLI v1.0.0 starting — output=json, logLevel=info, logFile=./uip.log"}
{"time":"2026-04-24T18:42:00.123Z","level":"info","message":"CLI v1.0.0 starting — output=json, logLevel=info, logFile=./uip.log"}

此格式专为日志托运程序(Fluent Bit、Loki、Splunk)和事后剖析而设计。

全局选项适用位置

在解析每个命令的标志之前,已从命令行中删除全局选项,因此它们可以出现在命令行上的任何位置:

uip --output table or folders list
uip or --output table folders list
uip or folders list --output table
uip or folders list --output=table
uip --output table or folders list
uip or --output table folders list
uip or folders list --output table
uip or folders list --output=table

所有四个调用效果等效。

工具子命令未定义自己的--output--log-level 。无意中定义了一个标志的工具会覆盖全局标志——CLI 的 lint 检查禁止这样做。

退出代码

全局选项仅控制输出和日志记录;它们不会影响退出代码。请参阅退出代码

另请参阅

  • --输出
  • 流分离
  • --输出筛选器
  • --日志级别
  • --日志文件
  • 全局选项适用位置
  • 退出代码
  • 另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新