Skip to content

feat: add support for fish#164

Open
Sunrisepeak wants to merge 4 commits intoament:rollingfrom
Sunrisepeak:feat/add_support_for_fish
Open

feat: add support for fish#164
Sunrisepeak wants to merge 4 commits intoament:rollingfrom
Sunrisepeak:feat/add_support_for_fish

Conversation

@Sunrisepeak
Copy link

No description provided.

Signed-off-by: sunrisepeak <speakshen@163.com>
Signed-off-by: sunrisepeak <speakshen@163.com>
@Sunrisepeak Sunrisepeak changed the title Feat/add support for fish feat: add support for fish Mar 18, 2026
Sunrisepeak added a commit to Sunrisepeak/ros2cli that referenced this pull request Mar 18, 2026
- ament/ament_package#164
- ros2#326

Signed-off-by: sunrisepeak <speakshen@163.com>
Sunrisepeak added a commit to Sunrisepeak/ros2cli that referenced this pull request Mar 18, 2026
- ament/ament_package#164
- ros2#326

Signed-off-by: sunrisepeak <speakshen@163.com>
@Sunrisepeak
Copy link
Author

@Sunrisepeak
Copy link
Author

Test on Ubuntu24.4 (jazzy)

Test (test_fish_support.sh)

#!/bin/bash
set -e

# Test Repo Path
#  - $1: ament_package
#  - $2: ros2cli

if [ -z "$1" ] || [ -z "$2" ]; then
    echo "Usage: $0 <ament_package_repo> <ros2cli_repo>"
    exit 1
fi

AP=$1/ament_package
RC=$2/ros2cli

ROSD=jazzy

echo rosd: $ROSD
echo ament_packge: $AP
echo ros2cli: $RC

echo ---

AP=$1/ament_package
RC=$2/ros2cli

# install prefix-level files
sudo cp $AP/template/prefix_level/setup.fish /opt/ros/$ROSD/setup.fish
sed -e "s|@CMAKE_INSTALL_PREFIX@|/opt/ros/$ROSD|g" \
    -e 's|@ament_package_PYTHON_EXECUTABLE@|/usr/bin/python3|g' \
    $AP/template/prefix_level/local_setup.fish.in | sudo tee /opt/ros/$ROSD/local_setup.fish > /dev/null

sudo cp $AP/template/prefix_level/_local_setup_util.py /opt/ros/$ROSD/_local_setup_util.py

# install ros2cli fish complete
sudo cp $RC/completion/ros2-argcomplete.fish /opt/ros/$ROSD/share/ros2cli/environment/ros2-argcomplete.fish
grep -q 'argcomplete.fish' /opt/ros/$ROSD/share/ros2cli/package.dsv || \
    echo 'source;share/ros2cli/environment/ros2-argcomplete.fish' | sudo tee -a /opt/ros/$ROSD/share/ros2cli/package.dsv > /dev/null

# test
fish -c "
    source /opt/ros/$ROSD/setup.fish
    echo \"ROS_DISTRO = \$ROS_DISTRO\"
    ros2 -h
    functions -q __fish_ros2_complete; and echo \"ros2 completion: OK\"
"

Use in fish shell

bash yourPath/test_fish_support.sh ament_package_LocalRepoPath ros2cli_LocalRepoPath
source /opt/ros/jazzy/setup.fish

Output

rosd: jazzy
ament_packge: .../ament_package/ament_package
ros2cli: .../ros2cli/ros2cli
---
ROS_DISTRO = jazzy
usage: ros2 [-h] [--use-python-default-buffering] Call `ros2 <command> -h` for more detailed usage. ...

ros2 is an extensible command-line tool for ROS 2.

options:
  -h, --help            show this help message and exit
  --use-python-default-buffering
                        Do not force line buffering in stdout and instead use the python default buffering, which
                        might be affected by PYTHONUNBUFFERED/-u and depends on whatever stdout is interactive or
                        not

Commands:
  action     Various action related sub-commands
  bag        Various rosbag related sub-commands
  component  Various component related sub-commands
  daemon     Various daemon related sub-commands
  doctor     Check ROS setup and other potential issues
  interface  Show information about ROS interfaces
  launch     Run a launch file
  lifecycle  Various lifecycle related sub-commands
  multicast  Various multicast related sub-commands
  node       Various node related sub-commands
  param      Various param related sub-commands
  pkg        Various package related sub-commands
  plugin     Various plugin related sub-commands
  run        Run a package specific executable
  security   Various security related sub-commands
  service    Various service related sub-commands
  topic      Various topic related sub-commands
  wtf        Use `wtf` as alias to `doctor`

  Call `ros2 <command> -h` for more detailed usage.
ros2 completion: OK

Signed-off-by: sunrisepeak <speakshen@163.com>
Signed-off-by: sunrisepeak <speakshen@163.com>
@Sunrisepeak
Copy link
Author

pr ready

  • test on ubuntu 24.04
  • Opus4.6/Codex double review + optimze

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.

1 participant