From: Samir Benmendil Date: Wed, 26 Nov 2014 17:40:03 +0000 (+0000) Subject: zsh: rosinit now supports multiple distros + default to indigo X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/34941dbc197d4fbc8220b8ed99648124e614d4b6 zsh: rosinit now supports multiple distros + default to indigo --- diff --git a/zsh/functions/rosinit b/zsh/functions/rosinit index 245cd3f..4b297d8 100644 --- a/zsh/functions/rosinit +++ b/zsh/functions/rosinit @@ -1,8 +1,16 @@ #!/bin/zsh function rosinit() { - local ROS_DISTRO=hydro local WORKSPACE=~/src/ros + local -a ROS_DISTROS + ROS_DISTROS=("hydro" "indigo") + + local ROS_DISTRO=$1 + if [[ -z "$ROS_DISTRO" ]]; then + for d in "${ROS_DISTROS[@]}"; do + [[ -f "/opt/ros/$d/setup.zsh" ]] && ROS_DISTRO=$d + done + fi if [[ -f "/opt/ros/$ROS_DISTRO/setup.zsh" ]]; then export ROS_OS_OVERRIDE=arch source /opt/ros/$ROS_DISTRO/setup.zsh