generated from wessel/boilerplate
37 lines
1.1 KiB
Fish
37 lines
1.1 KiB
Fish
export env_name="ros2-assignments"
|
|
|
|
# Check if a previous initialization has occurred
|
|
if test -n "$__ACTIVATE_INITIALIZED"
|
|
exit 1
|
|
end
|
|
|
|
export __ACTIVATE_INITIALIZED="1"
|
|
|
|
# Check if running inside distrobox
|
|
if test -f /run/.containerenv; or test -n "$CONTAINER_ID"
|
|
bass source /opt/ros/jazzy/setup.bash
|
|
bass source ./install/setup.bash
|
|
# Set environment variable for the prompt prefix
|
|
set -gx ROS2_LECTURES_ACTIVE 1
|
|
|
|
# Save the original prompt function if it exists
|
|
if not functions -q __ros2_lectures_orig_prompt
|
|
if functions -q fish_prompt
|
|
functions -c fish_prompt __ros2_lectures_orig_prompt
|
|
else
|
|
function __ros2_lectures_orig_prompt
|
|
echo -n (whoami)'@'(prompt_hostname)' '(set_color $fish_color_cwd)(prompt_pwd)(set_color normal)'> '
|
|
end
|
|
end
|
|
end
|
|
|
|
# Define new prompt with ros2-lectures prefix
|
|
function fish_prompt
|
|
echo -n (set_color green)'('$env_name')'(set_color normal)
|
|
__ros2_lectures_orig_prompt
|
|
end
|
|
else
|
|
echo "This script should only be run inside a distrobox container"
|
|
exit 1
|
|
end
|