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

全局选项

每个 "uip" 调用接受的全局选项,包括输出格式、输出筛选器、日志级别和日志文件。

在任何工具或子命令看到其参数之前,每次 uip 调用都会预扫描一组固定的全局选项 — 它们可以出现在命令行中的任何位置,在每个工具中以相同的方式工作,并且会在每个命令的标志解析之前被移除。

选项默认用途
--outputtablejsonyamlplainmarkdownjson写入标准输出的主要输出格式。
--json标记--output json 的隐藏兼容性别名。将其与显式 --output <value> 一起传递构成冲突 — 见下文。
--output-filterJMES 路径表达式在格式化之前,对 JSON 有效负载应用后置筛选器。
--log-leveldebuginfowarnerrorinfo写入 标准derr 的日志消息的详细信息(和--log-file ,如果已设置)。
--log-file路径如果设置,则日志将以 JSON 行格式复制到此文件中。
--profilename选择已保存的已命名登录配置文件,而不是默认的凭据位置。与命令自己的 -f, --file <folder> 互斥(例如,在 uip loginuip login tenant list/setuip logout 上)— 同时传递两者是 ValidationError。请参阅会话和凭据
--interactive / --no-interactive标记自动(仅在 TTY 上提示)强制开启或关闭提示,覆盖默认的“仅在连接到 TTY 时提示”行为。不特定于任何单个命令 — 它监管 uip 命令会提出问题的每个位置(例如 uip login 上的租户选择,或 uip skills install 上的智能体/目标选取器)。

--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 --output markdown   # GitHub-flavored markdown, for agents/chat surfaces
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 --output markdown   # GitHub-flavored markdown, for agents/chat surfaces
  • json (默认)— 标准输出上的一个 JSON 文档。可由jq--output-filter和任何 JSON 使用者解析。无论终端是否为 TTY,这是每次调用的默认设置。
  • table — 适合在终端中阅读的有边框彩色表格。跨版本不稳定 — 请勿解析。
  • yaml — 结构与json相同的 YAML 序列化。
  • plain — 展平key=value行。用于在无需安装readgrepcut jq情况下连接到 shell 。
  • markdown — GFM 表格表示列表,或**key:** value行表示单个记录。用于读取 uip 输出的智能体或聊天界面,而非终端会话。有关完整行为,请参阅输出格式 — Markdown
备注:

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

--json(隐藏别名)

--json--output json 的隐藏兼容性别名,它不会出现在 --help 中,但功能齐全:

uip or folders list --json   # identical to --output json
uip or folders list --json   # identical to --output json

--json 与显式 --output <value>(任何值,包括 json)一起传递,会在内部将其标记为冲突;避免将它们结合使用 — 忽略另一个。

--配置文件

选择已保存的已命名登录配置文件,而不是默认凭据位置:

uip login --profile ci-runner --client-id env.UIPATH_CLIENT_ID --client-secret env.UIPATH_CLIENT_SECRET --tenant Production
uip or folders list --profile ci-runner
uip login --profile ci-runner --client-id env.UIPATH_CLIENT_ID --client-secret env.UIPATH_CLIENT_SECRET --tenant Production
uip or folders list --profile ci-runner

--profile <name> 与命令自己的 -f, --file <folder> 互斥 — 两者同时通过将失败,并显示 ValidationError: option '--profile' cannot be used with option '--file'。配置文件名称已标准化(大小写和分隔符规则适用);在进行任何网络调用之前,系统会拒绝无效名称。请参阅会话和凭据 — 命名配置文件

--interactive / --no-interactive

覆盖默认的“仅当标准输出是 TTY 时才提示”行为:

uip login --interactive        # force the tenant-selection prompt even when not on a TTY
uip skills install --no-interactive --agent claude   # never prompt, fail instead if a required choice is missing
uip login --interactive        # force the tenant-selection prompt even when not on a TTY
uip skills install --no-interactive --agent claude   # never prompt, fail instead if a required choice is missing

--interactive 将提示设置为“始终开启”; --no-interactive 会强制将其关闭。这两个标志都不是特定于 uip login — 尽管交互性出现在本文档集的整个登录示例中,但它是一个横向全局选项,没有特定于命令的缩写形式(CLI 中的任何位置都没有 --it 或类似的别名)。

流分离

--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 检查禁止这样做。

退出代码

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

环境变量覆盖

有两个环境变量在不使用标志的情况下更改全局选项行为:

变量效果
UIP_DEFAULT_OUTPUT如果未传递该标志,则覆盖 json 的内置 --output 默认值。接受 tablejsonyamlplainmarkdown;无效值将被忽略。始终优先使用命令行中的显式 --output
UIP_TIMINGS设置为 1true 后,可在每个 uip 命令中将每次调用的时间线打印到标准错误 (stderr)。请参阅下面的命令时间

命令时间

设置 UIP_TIMINGS=1(或 true)时,每次调用都会在标准错误中打印一行:

[timing] 'uip or assets list' exit=0 total=1250ms startup=380ms command=863ms http=691ms httpCalls=3 flush=7ms
[timing] 'uip or assets list' exit=0 total=1250ms startup=380ms command=863ms http=691ms httpCalls=3 flush=7ms
字段意义
(带引号的命令)输入的命令。
exit调用返回的退出代码。
total从流程开始计算,总挂机时间。
startup运行命令处理程序之前的所有操作 — 流程启动、配置、工具加载。
command命令处理程序本身。
http运行出站 HTTP 调用的总持续时间 — 一个总和,而不是 挂表时间。它与 command 重叠,而不是添加到 command 中,因此并行调用可能会使其大于 。
httpCalls该总和涵盖的出站 HTTP 调用数量。
flush处理程序返回后的所有操作 — 遥测簿记和最终刷新。

startup + command + flush 始终等于 total。当字段不适用时,系统会省略字段:从未到达处理程序的运行(uip --version、未知命令)仅打印 totalexit;不进行 HTTP 调用的命令既没有 http,也没有 httpCalls

报告有自己的开关,它不依赖于 --log-level,因此您无需打开调试输出即可获取持续时间,并且标准输出也不会受到影响。

另请参阅

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新