From 349d48369ad711a00f0f84fff4ea7c49af16c3e7 Mon Sep 17 00:00:00 2001
From: Andres Montano <andres.montano@tecnalia.com>
Date: Sat, 9 Nov 2024 17:11:30 +0100
Subject: [PATCH] Add support to zsh into devcontainer

---
 config/.devcontainer/Dockerfile        |  6 +++---
 config/.devcontainer/devcontainer.json |  3 ++-
 config/.vscode/tasks.json              | 23 ++++++++++++++++-------
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/config/.devcontainer/Dockerfile b/config/.devcontainer/Dockerfile
index c7f7cba..cf113cc 100644
--- a/config/.devcontainer/Dockerfile
+++ b/config/.devcontainer/Dockerfile
@@ -29,9 +29,9 @@ WORKDIR /home/$USERNAME
 # ********************************************************
 
 # [Optional] Clone dotfiles and apply configuration
-# RUN git clone https://github.com/andsens/homeshick.git /home/$USERNAME/.homesick/repos/homeshick \
-#     && /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick clone anfemosa/dotfiles \
-#     && /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick -f link dotfiles
+RUN git clone https://github.com/andsens/homeshick.git /home/$USERNAME/.homesick/repos/homeshick \
+    && /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick clone anfemosa/dotfiles \
+    && /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick -f link dotfiles
 
 CMD ["${SHELL}"]
 
diff --git a/config/.devcontainer/devcontainer.json b/config/.devcontainer/devcontainer.json
index bf25fb3..e135a16 100644
--- a/config/.devcontainer/devcontainer.json
+++ b/config/.devcontainer/devcontainer.json
@@ -5,7 +5,8 @@
     "build": {
         "dockerfile": "Dockerfile",
         "args": {
-            "USERNAME": "andres"
+            "USERNAME": "andres",
+            "SHELL": "/bin/zsh"
         }
     },
     "workspaceFolder": "/home/ws",
diff --git a/config/.vscode/tasks.json b/config/.vscode/tasks.json
index 90cf57d..e0bae72 100644
--- a/config/.vscode/tasks.json
+++ b/config/.vscode/tasks.json
@@ -7,11 +7,12 @@
             "label": "colcon: build (debug)",
             "type": "shell",
             "command": [
-                "source /opt/ros/humble/setup.zsh;",
+                "source /opt/ros/humble/setup.${ext};",
                 "colcon build",
                 "--symlink-install",
                 "--cmake-args -DCMAKE_BUILD_TYPE=Debug",
-                "--packages-skip allegro_hand_weiss"
+                "--packages-skip allegro_hand_weiss;",
+                "source ${workspaceFolder}/install/setup.${ext};"
             ],
             "problemMatcher": [],
             "group": {
@@ -23,10 +24,11 @@
             "label": "colcon: build",
             "type": "shell",
             "command": [
-                "source /opt/ros/humble/setup.zsh;",
+                "source /opt/ros/humble/setup.${ext};",
                 "colcon build",
                 "--symlink-install",
-                "--packages-skip allegro_hand_weiss"
+                "--packages-skip allegro_hand_weiss",
+                "source ${workspaceFolder}/install/setup.${ext};"
             ],
             "problemMatcher": [],
             "group": {
@@ -45,12 +47,19 @@
             "label": "colcon: test",
             "type": "shell",
             "command": [
-                "source /opt/ros/humble/setup.zsh;",
-                "source install/setup.zsh;",
+                "source /opt/ros/humble/setup.${ext};",
+                "source install/setup.${ext};",
                 "colcon test",
                 "--packages-select <package-name>",
                 "--event-handlers console_direct+;"
             ]
-        }
+        },
+        {
+            "label": "workspace: source",
+            "type": "shell",
+            "command": [
+                "source ${workspaceFolder}/install/setup.${ext};"
+            ]
+        },
     ]
 }
\ No newline at end of file
-- 
GitLab