ros2 / ros2cli

ROS 2 command line interface tools
Apache License 2.0
172 stars 161 forks source link

ZSH argcomplete: call compinit only if needed #750

Closed mjbogusz closed 1 year ago

mjbogusz commented 2 years ago

Ref #534

nachovizzo commented 1 year ago

I manually patched this file and didn't solve the problem in my case. I just threw this into my .zshrc in the meantime (and it's working)

function ros2_setup () {
  source /opt/ros/humble/setup.zsh
  complete -o nospace -o default -F _python_argcomplete "ros2"
}
mjbogusz commented 1 year ago

This is only one of several places where compinit is called - see the list in referenced discussion. In particular I think sourcing ROS by default pulls in ros2cli, rosidl and ament_index, but depending on colcon hooks of your installed packages this may vary.