]> git.rmz.io Git - dotfiles.git/commitdiff
zsh: move ros initialisation to its own function
authorSamir Benmendil <samir.benmendil@gmail.com>
Sat, 8 Feb 2014 06:46:02 +0000 (07:46 +0100)
committerSamir Benmendil <samir.benmendil@gmail.com>
Sat, 8 Feb 2014 06:46:02 +0000 (07:46 +0100)
zsh/functions/rosinit [new file with mode: 0644]
zshrc

diff --git a/zsh/functions/rosinit b/zsh/functions/rosinit
new file mode 100644 (file)
index 0000000..245cd3f
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/zsh
+
+function rosinit() {
+    local ROS_DISTRO=hydro
+    local WORKSPACE=~/src/ros
+    if [[ -f "/opt/ros/$ROS_DISTRO/setup.zsh" ]]; then
+        export ROS_OS_OVERRIDE=arch
+        source /opt/ros/$ROS_DISTRO/setup.zsh
+        source $WORKSPACE/devel/setup.zsh
+        export ROS_WORKSPACE=$WORKSPACE
+        roscd
+    else
+        echo "ROS $ROS_DISTRO doesn't seem to be installed." >&2
+    fi
+}
diff --git a/zshrc b/zshrc
index cf7be9bdd973a92c9d97fdf6074b78004ca48cba..2d8463f1d40d927f0a33d8c52a27f86d5150a726 100644 (file)
--- a/zshrc
+++ b/zshrc
@@ -67,8 +67,3 @@ hash -d UniMaas=~/dropbox/Documents/UniMaas
 # set some env variables
 export _gamedir=/mnt/Skaro/Games/Linux/HumbleBundle
 
-# ros
-if [[ -f "/opt/ros/groovy/setup.zsh" ]]; then
-    export ROS_WORKSPACE=~/src/ros
-    export ROS_OS_OVERRIDE=arch
-fi