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

UiPath CLI 用户指南

UIP 补全

uip completionuip安装、打印或删除 shell 选项卡补全。它支持bashzshfispwsh (PowerShell)。在 TTY 中调用且无显式 shell 参数的情况下为交互式;当给定 shell 参数或标准输出不是 TTY 时,将补全脚本转储到标准输出。

有关完整演练,包括每个 Shell 的 rc 文件示例和代理说明,请参阅安装 UiPath CLI — 启用 Shell 完成

大纲

uip completion [shell] [--print] [--uninstall]
uip completion [shell] [--print] [--uninstall]

所有标志都遵循全局选项--output--output-filter--log-level--log-file )。退出代码遵循标准合同;使用130 (用户取消)取消交互式确认提示词。

参数

  • [shell] (可选)bashzshfishpwsh之一(别名: powershell )。如果省略,则系统会从$SHELL / $PSModulePath /平台自动检测 Shell。

选项

  • --print — 打印目标 rc 文件的路径和要写入的块,而不修改文件系统。用于预览uip completion执行操作。
  • --uninstall — 删除托管补全块(或者,对于 fis,则为生成的补全文件),而不是安装。幂等 — 如果该块已不存在,则执行“空”操作。

行为

该命令遵循简单的三分支规则:

  1. 交互式安装(无 Shell 参数,标准输出为 TTY)— 自动检测 Shell,打印目标 rc 文件,并在写入前提示确认。按 Ctrl-C 取消退出130

  2. 脚本转储(显式 shell 参数,标准输出不是 TTY)— 将生成的补全脚本写入标准输出。将其通过管道传输到您的 rc 文件中或直接获取:

    uip completion zsh >> ~/.zshrc
    uip completion bash >> ~/.bashrc
    uip completion fish > ~/.config/fish/completions/uip.fish
    uip completion pwsh >> $PROFILE
    uip completion zsh >> ~/.zshrc
    uip completion bash >> ~/.bashrc
    uip completion fish > ~/.config/fish/completions/uip.fish
    uip completion pwsh >> $PROFILE
    
  3. 卸载( --uninstall ) — 删除托管块,无论 TTY 状态如何。

示例

# Interactive install — auto-detect shell, prompt, write rc file
uip completion

# Preview without touching the filesystem
uip completion --print

# Dump the zsh script to a specific rc file
uip completion zsh >> ~/.zshrc

# Dump the PowerShell script to your profile
uip completion pwsh >> $PROFILE

# Remove the managed completion block
uip completion --uninstall
# Interactive install — auto-detect shell, prompt, write rc file
uip completion

# Preview without touching the filesystem
uip completion --print

# Dump the zsh script to a specific rc file
uip completion zsh >> ~/.zshrc

# Dump the PowerShell script to your profile
uip completion pwsh >> $PROFILE

# Remove the managed completion block
uip completion --uninstall

数据形状(--输出 json)

安装成功后:

{
  "Code": "CompletionInstalled",
  "Data": {
    "shell": "zsh",
    "path": "/Users/alice/.zshrc",
    "action": "appended",
    "notes": [
      "Dynamic flag-value completion (e.g. --package-name <TAB>) requires `jq` on PATH; without it, those candidates are suppressed."
    ]
  }
}
{
  "Code": "CompletionInstalled",
  "Data": {
    "shell": "zsh",
    "path": "/Users/alice/.zshrc",
    "action": "appended",
    "notes": [
      "Dynamic flag-value completion (e.g. --package-name <TAB>) requires `jq` on PATH; without it, those candidates are suppressed."
    ]
  }
}

--print上:

{
  "Code": "CompletionPrint",
  "Data": {
    "shell": "zsh",
    "path": "/Users/alice/.zshrc",
    "mode": "block",
    "content": "# >>> uip completion >>>\n…generated script…\n# <<< uip completion <<<"
  }
}
{
  "Code": "CompletionPrint",
  "Data": {
    "shell": "zsh",
    "path": "/Users/alice/.zshrc",
    "mode": "block",
    "content": "# >>> uip completion >>>\n…generated script…\n# <<< uip completion <<<"
  }
}

--uninstall上:

{
  "Code": "CompletionUninstalled",
  "Data": {
    "shell": "zsh",
    "path": "/Users/alice/.zshrc",
    "action": "removed"
  }
}
{
  "Code": "CompletionUninstalled",
  "Data": {
    "shell": "zsh",
    "path": "/Users/alice/.zshrc",
    "action": "removed"
  }
}

故障模式

  • 不支持的 ShellFailureMessage: "Unsupported shell: <name>" ,有关使用bashzshfishpwsh之一的说明。
  • 命令名称中的 Shell 特殊字符Failure ,来自 zsh/fies 生成器;重命名有问题的命令或打开一个问题。
  • 没有 rc 文件Failure的写入权限,其中包含用于检查目标路径权限的说明。
  • 用户取消确认提示— 退出130 (无信封)。

动态标志值补全

静态补全(子命令名称、选项名称)适用于所有四种 Shell。动态标志值补全(例如,建议实时包名称的uip or packages upload --package-name <TAB> )目前仅适用于 zsh ,并且需要jq上的PATH 。如果没有jq ,系统将静默禁止动态候选对象;如果适用,安装步骤会在notes[]数组中发出注释。

静态快照:每次升级后重新运行

生成的补全脚本是运行uip completion时已知子命令名称和选项名称的静态快照。Shell 启动时不会重新生成该文件。在执行以下任何操作后,请重新运行uip completion ,以便新添加的动词和标志显示在制表符补全中:

  • npm install -g @uipath/cli@<new-version> — 主机已更改,可能存在新的全局标志或顶级命令。
  • uip tools install <new-tool> — 一个您之前没有的工具,现已安装;其别名和动词尚未出现在脚本中。
  • uip tools update — 已安装的工具已移至新的 MINOR;可能添加了新的动词或标志。
uip completion              # interactive — refreshes the existing block
uip completion zsh >> ~/.zshrc   # or pipe into the rc file directly
uip completion              # interactive — refreshes the existing block
uip completion zsh >> ~/.zshrc   # or pipe into the rc file directly

如果不刷新,新动词仍然可在命令行中使用,只是<TAB>不会再提供建议。动态标志值补全(上述仅使用 zsh 的情况)是在运行时解析的一部分;其他所有内容都需要刷新。

另请参阅

  • uip 工具uip completion反映已安装工具的子命令;如果要完成新安装的命令,请在uip tools install后重新运行。
  • 全局选项--output--output-filter--log-level--log-file
  • 退出代码— 标准合同加上用于取消用户的130

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新