]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: rosinit now supports multiple distros + default to indigo
authorSamir Benmendil <samir.benmendil@gmail.com>
Wed, 26 Nov 2014 17:40:03 +0000 (17:40 +0000)
committerSamir Benmendil <samir.benmendil@gmail.com>
Wed, 26 Nov 2014 17:40:03 +0000 (17:40 +0000)
zsh/functions/rosinit

index 245cd3fc83d13b68bf26fcc00e33ad98125b2092..4b297d818a846d6c73d5d19905c5bd01a16e6362 100644 (file)
@@ -1,8 +1,16 @@
 #!/bin/zsh
 
 function rosinit() {
 #!/bin/zsh
 
 function rosinit() {
-    local ROS_DISTRO=hydro
     local WORKSPACE=~/src/ros
     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
     if [[ -f "/opt/ros/$ROS_DISTRO/setup.zsh" ]]; then
         export ROS_OS_OVERRIDE=arch
         source /opt/ros/$ROS_DISTRO/setup.zsh