Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native support to fish shell #1168

Merged
merged 12 commits into from
Mar 24, 2022

Conversation

FelipeGdM
Copy link
Contributor

@FelipeGdM FelipeGdM commented Feb 28, 2022

The fish shell is an alternative shell to bash or zsh. It defines itself as a

smart and user-friendly command line shell for Linux, macOS, and the rest of the family.

Fish is already kind of supported by catkin with use of the helper bass, as documented in rosbash ROS wiki page. Specific support for it was already discussed in #921

This PR creates the files setup.fish.in and local_setup.fish.in to provide native setup scripts for fish users. The main benefit from this update is the possibility to use fish scripts as environment hooks in catkin workspaces.

For example, the script rosfish (actual template here) is declared as env hook in the package rosbash

Since bass source setup.bash runs a bash-like setup, this fish env hook is not loaded, so the usual sequence of commands to start a fish workspace is (as shown in rosbash docs)

bass source ~/catkin_ws/devel/setup.bash
source /opt/ros/noetic/share/rosbash/rosfish

With this PR, it becomes a simple

source ~/catkin_ws/devel/setup.fish

With the bonus that not only rosfish is loaded, but also any other fish-specific env hook in the workspace. It is particularly useful to extend packages like ROS Workspace Scripts to fish environments

cmake/templates/setup.fish.in Outdated Show resolved Hide resolved
cmake/templates/setup.fish.in Outdated Show resolved Hide resolved
@FelipeGdM FelipeGdM force-pushed the feature/fish_support branch from 3f82a63 to 4b5cc68 Compare March 2, 2022 11:52
FelipeGdM added a commit to FelipeGdM/ros that referenced this pull request Mar 2, 2022
When ROS added support to fish, the recommended procedure was using
source.bash and then manually source rosfish. In this flow,
rosbash.fish env hook was never called. To add native support to fish
(see ros/catkin#1168), it is needed to ensure
consistency along files (scripts ended w/ .fish should be compatible w/
fish)
@FelipeGdM
Copy link
Contributor Author

@gbiggs I applied the suggested changes and added some fixes for problems that appeared upon further testing

One important addition was the backwards compatibility check to handle .sh scripts registered as fish env hooks. In terms of codebase maintenance, it may be not be a problem to preserve .sh scripts in the fish stack (and thus prevent unnecessary code duplication), bass can handle them as long as they don't declare any bash functions.

In this effort, PR ros/ros#301 was created in order to assert consistency among ROS files

@gbiggs gbiggs merged commit be490b2 into ros:noetic-devel Mar 24, 2022
paulbovbel added a commit to locusrobotics/catkin that referenced this pull request Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants