启用 colcon的命令自动补全功能,适用于 bash终端

shell 复制代码
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
  • colcon 是 ROS 2(Robot Operating System 2)中常用的构建工具,而 colcon-argcomplete 提供了 shell 命令补全(autocomplete)功能。

  • source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash 这条命令会加载 colcon 的自动补全脚本,使得在终端输入 colcon 命令时,可以使用 Tab 键 自动补全子命令和参数 (双击Tab键) ,例如:

    bash 复制代码
    colcon <Tab>

    可能会列出 buildtestlist 等子命令。

什么时候需要执行这条命令?

  • 如果 colcon 的自动补全功能没有生效,你可以手动执行这条命令。

  • 你可以把这行指令添加到 ~/.bashrc~/.bash_profile,让其在每次打开终端时自动加载:

    bash 复制代码
    echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc
    source ~/.bashrc

如果你使用的是 zsh,可能需要额外配置 argcomplete,让 colcon 补全功能在 zsh 里生效。

相关推荐
咖啡の猫2 天前
bash的特性-bash中的引号
开发语言·chrome·bash
咖啡の猫3 天前
bash的特性-常见的快捷键
开发语言·chrome·bash
咖啡の猫3 天前
bash的特性-常用的通配符
开发语言·chrome·bash
<但凡.4 天前
Git 完全手册:从入门到团队协作实战(4)
git·bash
骁的小小站5 天前
The Missing Semester of Your CS Education 学习笔记以及一些拓展知识(六)
linux·经验分享·笔记·学习·bash
2301_789380497 天前
华为云搭建Calibre-Web云端书库全记录
服务器·docker·云原生·华为云·bash
开开心心就好8 天前
Excel数据合并工具:零门槛快速整理
运维·服务器·前端·智能手机·pdf·bash·excel
RoronoaV5879 天前
Linux系统安装Bash自动补全(bash-completion)
linux·运维·bash
众乐乐_200810 天前
git bash命令不够完善,想整合msys2该怎么办?
git·elasticsearch·bash
骁的小小站10 天前
The Missing Semester of Your CS Education 学习笔记以及一些拓展知识(三)
开发语言·经验分享·笔记·学习·其他·bash·excel