Skip to content

Commit

Permalink
Fixes related to env vars and logging (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh authored May 1, 2024
2 parents 2c27a09 + f545e44 commit 4b5486e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
6 changes: 5 additions & 1 deletion qtcreator/setup
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ function qtcreator
if [[ ! -v TUE_ENV_ROS_VERSION && -v TUE_ROS_VERSION ]]
then
TUE_ENV_ROS_VERSION=${TUE_ROS_VERSION}
>&2 echo "Change the config of your environment to use 'TUE_ENV_ROS_VERSION' instead of 'TUE_ROS_VERSION'"
>&2 echo -e "\e[33;1m[qtcreator] Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'.\e[0m"
fi

# TODO(anyone): remove when tue-env is updated to new variable names
[[ -v TUE_ENV_WS_DIR || ! -v TUE_WS_DIR ]] || TUE_ENV_WS_DIR=${TUE_WS_DIR}

if [[ "${TUE_ENV_ROS_VERSION}" -eq 1 ]]
then
# Make sure packages can be build by QT
Expand Down
2 changes: 1 addition & 1 deletion ros-swri_console/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
if [[ ! -v TUE_ENV_ROS_VERSION && -v TUE_ROS_VERSION ]]
then
TUE_ENV_ROS_VERSION=${TUE_ROS_VERSION}
>&2 echo "Change the config of your environment to use 'TUE_ENV_ROS_VERSION' instead of 'TUE_ROS_VERSION'"
>&2 echo -e "\e[33;1m[ros-swri_console] Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'.\e[0m"
fi
if [[ "${TUE_ENV_ROS_VERSION}" -eq 1 ]]
then
Expand Down
6 changes: 3 additions & 3 deletions ros1/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
if [[ ! -v TUE_ENV_ROS_DISTRO && -v TUE_ROS_DISTRO ]]
then
TUE_ENV_ROS_DISTRO=${TUE_ROS_DISTRO}
>&2 echo "Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'"
>&2 echo -e "\e[33;1m[ros1] Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'.\e[0m"
fi
if [[ -z "${TUE_ENV_ROS_DISTRO}" ]]
then
echo -e "\e[31;1m[ros] TUE_ENV_ROS_DISTRO was not set\e[0m"
>&2 echo -e "\e[31;1m[ros] TUE_ENV_ROS_DISTRO was not set.\e[0m"
return 1
fi

Expand All @@ -20,7 +20,7 @@ then
# shellcheck disable=SC1091
source "${TUE_ENV_WS_DIR}"/devel/setup.bash
else
echo -e "\e[33;1m[ros] system workspaces not found, sourcing /opt/ros\e[0m"
>&2 echo -e "\e[33;1m[ros] system workspaces not found, sourcing /opt/ros\e[0m"
# shellcheck disable=SC1090
source /opt/ros/"${TUE_ENV_ROS_DISTRO}"/setup.bash
fi
Expand Down
10 changes: 5 additions & 5 deletions ros2/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
if [[ ! -v TUE_ENV_ROS_DISTRO && -v TUE_ROS_DISTRO ]]
then
TUE_ENV_ROS_DISTRO=${TUE_ROS_DISTRO}
>&2 echo "Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'"
>&2 echo -e "\e[33;1m[ros2] Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'.\e[0m"
fi
if [[ -z "${TUE_ENV_ROS_DISTRO}" ]]
then
echo "[ros2] TUE_ENV_ROS_DISTRO was not set"
>&2 echo -e "\e[31;1m[ros2] TUE_ENV_ROS_DISTRO was not set.\e[0m"
return 1
fi

Expand All @@ -18,7 +18,7 @@ then
# shellcheck disable=SC1090
source "/opt/ros/${TUE_ENV_ROS_DISTRO}/setup.bash"
else
echo -e "\033[33;1m[ros2] ROS 2 ${TUE_ENV_ROS_DISTRO} setup.bash not found. \033[0m"
>&2 echo -e "\e[33;1m[ros2] ROS 2 ${TUE_ENV_ROS_DISTRO} setup.bash not found.\e[0m"
fi

# TODO(anyone): remove when tue-env is updated to new variable names
Expand All @@ -29,7 +29,7 @@ then
# shellcheck disable=SC1091
source "${TUE_ENV_WS_DIR}/install/local_setup.bash"
else
echo -e "\033[33;1m[ros2] ${TUE_ENV_WS_DIR}/install/local_setup.bash not found. \033[0m"
>&2 echo -e "\e[33;1m[ros2] ${TUE_ENV_WS_DIR}/install/local_setup.bash not found.\e[0m"
fi

# Add Colcon sourcing to the shell startup script
Expand All @@ -40,7 +40,7 @@ then
# shellcheck disable=SC2016
export _colcon_cd_root="${TUE_ENV_WS_DIR}"
else
echo -e "\033[33;5;1m[ros2] colcon_cd setup not found. colcon_cd command disabled. \033[0m"
>&2 echo -e "\e[33;1m[ros2] colcon_cd setup not found. colcon_cd command disabled.\e[0m"
fi

# shellcheck disable=SC2016
Expand Down

0 comments on commit 4b5486e

Please sign in to comment.