From 2c0b1eda114cd850c1681f1bd7ec97ba1fd7a495 Mon Sep 17 00:00:00 2001 From: Chen Lihui Date: Mon, 15 Aug 2022 13:09:22 +0800 Subject: [PATCH] to support complete for rosidl and avoid calling multiple compinit Signed-off-by: Chen Lihui --- rosidl_cli/colcon.pkg | 6 ++++++ rosidl_cli/completion/rosidl-argcomplete.zsh | 2 ++ 2 files changed, 8 insertions(+) create mode 100644 rosidl_cli/colcon.pkg diff --git a/rosidl_cli/colcon.pkg b/rosidl_cli/colcon.pkg new file mode 100644 index 000000000..623d2898e --- /dev/null +++ b/rosidl_cli/colcon.pkg @@ -0,0 +1,6 @@ +{ + "hooks": [ + "share/rosidl_cli/environment/rosidl-argcomplete.bash", + "share/rosidl_cli/environment/rosidl-argcomplete.zsh" + ] +} diff --git a/rosidl_cli/completion/rosidl-argcomplete.zsh b/rosidl_cli/completion/rosidl-argcomplete.zsh index 9a86dbd23..060bc4b41 100644 --- a/rosidl_cli/completion/rosidl-argcomplete.zsh +++ b/rosidl_cli/completion/rosidl-argcomplete.zsh @@ -12,8 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +if ! type complete > /dev/null 2>&1; then autoload -U +X compinit && compinit autoload -U +X bashcompinit && bashcompinit +fi # Get this scripts directory __rosidl_cli_completion_dir=${0:a:h}