List sourced workspaces
I'm experimenting with shell plugins, dynamically updating command line prompt.
Currently I'm running Zsh + OhMyZsh + powerlevel10k
I've managed to add ROS2 distro name and ROS2 domain ID to the command prompt. That was easy: I've added a shell function looking at environment vars ROS_DISTRO
and ROS_DOMAIN_ID
:
function prompt_my_ros2_env() {
if [[ -v ROS_DISTRO ]]; then
local ros_domain_id=""
if [[ -v ROS_DOMAIN_ID ]]; then
ros_domain_id="[$ROS_DOMAIN_ID]"
fi
p10k segment -t "$ROS_DISTRO$ros_domain_id"
fi
}
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=my_ros2_env
Now I wonder, is it possible to create a list of sourced ROS2 workspaces?
I can see that some environment variables change after execution of source ./install/local_setup.zsh
command, for example AMENT_PREFIX_PATH
, PYTHONPATH
, LD_LIBRARY_PATH
. But sourcing one workspace adds several directories to almost each of them.