-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add support for fish #164
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
Merged
asymingt
merged 4 commits into
ament:rolling
from
Sunrisepeak:feat/add_support_for_fish
Mar 25, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # generated from ament_package/template/package_level/local_setup.fish.in | ||
|
|
||
| # since this file is sourced use the destination set at configure time | ||
| # and override it with COLCON_CURRENT_PREFIX when provided | ||
| set -l AMENT_CURRENT_PREFIX "@CMAKE_INSTALL_PREFIX@" | ||
| if test -n "$COLCON_CURRENT_PREFIX" | ||
| set AMENT_CURRENT_PREFIX "$COLCON_CURRENT_PREFIX" | ||
| end | ||
| if not test -d "$AMENT_CURRENT_PREFIX" | ||
| echo "The compile-time prefix path '$AMENT_CURRENT_PREFIX' doesn't exist. \ | ||
| Consider sourcing a different shell extension." 1>&2 | ||
| set -e AMENT_CURRENT_PREFIX | ||
| return 1 | ||
| end | ||
| set -l _package_local_setup_AMENT_CURRENT_PREFIX "$AMENT_CURRENT_PREFIX" | ||
|
|
||
| # function to append values to environment variables | ||
| # using colons as separators and avoiding leading separators | ||
| function ament_append_value | ||
| set -l _name $argv[1] | ||
| set -l _val $argv[2] | ||
| if set -q $_name; and test -n "$$_name" | ||
| set -gx $_name "$$_name:$_val" | ||
| else | ||
| set -gx $_name "$_val" | ||
| end | ||
| end | ||
|
|
||
| # unset AMENT_ENVIRONMENT_HOOKS | ||
| # if not appending to them for return | ||
| if not set -q AMENT_RETURN_ENVIRONMENT_HOOKS | ||
| set -e AMENT_ENVIRONMENT_HOOKS | ||
| end | ||
|
|
||
| # restore AMENT_CURRENT_PREFIX before evaluating environment hooks | ||
| set AMENT_CURRENT_PREFIX "$_package_local_setup_AMENT_CURRENT_PREFIX" | ||
|
|
||
| # list all environment hooks of this package | ||
| @ENVIRONMENT_HOOKS@ | ||
|
|
||
| functions -e ament_append_value | ||
|
|
||
| # source all shell-specific environment hooks of this package | ||
| # if not returning them | ||
| if not set -q AMENT_RETURN_ENVIRONMENT_HOOKS | ||
| for _hook in (string split ":" -- "$AMENT_ENVIRONMENT_HOOKS") | ||
| if string match -q -- "*.fish" "$_hook" | ||
| set -gx AMENT_CURRENT_PREFIX \ | ||
| "$_package_local_setup_AMENT_CURRENT_PREFIX" | ||
| if test -f "$_hook" | ||
| if test -n "$AMENT_TRACE_SETUP_FILES" | ||
| echo "# source \"$_hook\"" | ||
| end | ||
| source "$_hook" | ||
| end | ||
| end | ||
| end | ||
| set -e AMENT_ENVIRONMENT_HOOKS | ||
| end | ||
|
|
||
| set -e _package_local_setup_AMENT_CURRENT_PREFIX | ||
| # reset AMENT_CURRENT_PREFIX after each package | ||
| # allowing to source multiple package-level setup files | ||
| set -e AMENT_CURRENT_PREFIX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # generated from ament_package/template/prefix_level/local_setup.fish.in | ||
|
|
||
| # Prefer AMENT_CURRENT_PREFIX (set by setup.fish); otherwise use install-time prefix. | ||
| set -l _ament_prefix_fish_AMENT_CURRENT_PREFIX "@CMAKE_INSTALL_PREFIX@" | ||
| if test -n "$AMENT_CURRENT_PREFIX" | ||
| set _ament_prefix_fish_AMENT_CURRENT_PREFIX "$AMENT_CURRENT_PREFIX" | ||
| end | ||
|
|
||
| if not test -d "$_ament_prefix_fish_AMENT_CURRENT_PREFIX" | ||
| echo "The build-time prefix \"$_ament_prefix_fish_AMENT_CURRENT_PREFIX\" \ | ||
| doesn't exist. Either source a script for a different shell or set \ | ||
| AMENT_CURRENT_PREFIX explicitly." 1>&2 | ||
| set -e _ament_prefix_fish_AMENT_CURRENT_PREFIX | ||
| return 1 | ||
| end | ||
|
|
||
| # Locate a Python interpreter. | ||
| set -l _ament_python_executable "@ament_package_PYTHON_EXECUTABLE@" | ||
| if test -n "$AMENT_PYTHON_EXECUTABLE" | ||
| set _ament_python_executable "$AMENT_PYTHON_EXECUTABLE" | ||
| end | ||
| if not test -f "$_ament_python_executable" | ||
| if command -v python3 > /dev/null 2>&1 | ||
| set _ament_python_executable (python3 -c "import sys; print(sys.executable)") | ||
| else | ||
| echo "error: unable to find a python3 executable" 1>&2 | ||
| set -e _ament_prefix_fish_AMENT_CURRENT_PREFIX | ||
| return 1 | ||
| end | ||
| end | ||
|
|
||
| # Generate fish setup commands in topological order and source them. | ||
| # psub turns Python stdout into a real file path for source. | ||
| # Generated commands use fish-native env handling (set -gx and list PATH). | ||
| if test -n "$AMENT_TRACE_SETUP_FILES" | ||
| echo "# source (\"$_ament_python_executable\" \ | ||
| \"$_ament_prefix_fish_AMENT_CURRENT_PREFIX/_local_setup_util.py\" fish | psub)" | ||
| end | ||
|
|
||
| source (command "$_ament_python_executable" \ | ||
| "$_ament_prefix_fish_AMENT_CURRENT_PREFIX/_local_setup_util.py" fish | psub) | ||
|
|
||
| set -e _ament_python_executable | ||
| set -e _ament_prefix_fish_AMENT_CURRENT_PREFIX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # copied from ament_package/template/prefix_level/setup.fish | ||
|
|
||
| # Determine prefix from this script's location at runtime. | ||
| # 'status -f' gives the path of the currently sourced file in fish. | ||
| set -l AMENT_CURRENT_PREFIX (builtin realpath (dirname (status -f))) | ||
|
|
||
| # trace output | ||
| if test -n "$AMENT_TRACE_SETUP_FILES" | ||
| echo "# source \"$AMENT_CURRENT_PREFIX/local_setup.fish\"" | ||
| end | ||
|
|
||
| # Build ordered prefixes (same order as setup.sh.in) for overlay workspaces. | ||
| # Keep dedup inline: fish functions can't update caller local vars. | ||
| set -l _UNIQUE_PREFIX_PATH | ||
| set -l _parent_index \ | ||
| "$AMENT_CURRENT_PREFIX/share/ament_index/resource_index/parent_prefix_path" | ||
|
|
||
| if test -d "$_parent_index" | ||
| for _resource in (command ls "$_parent_index" 2>/dev/null | command sort) | ||
| read -z _content < "$_parent_index/$_resource" 2>/dev/null; or set _content "" | ||
| set -l _paths (string split ":" -- "$_content") | ||
| # Reverse the list (similar to setup.sh) | ||
| set -l _reversed | ||
| for _p in $_paths | ||
| if test "$_p" = "{prefix}" | ||
| set _p "$AMENT_CURRENT_PREFIX" | ||
| end | ||
| set _reversed "$_p" $_reversed | ||
| end | ||
| for _p in $_reversed | ||
| if not contains -- "$_p" $_UNIQUE_PREFIX_PATH | ||
| set -a _UNIQUE_PREFIX_PATH "$_p" | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| # Always include the current prefix last (highest priority). | ||
| if not contains -- "$AMENT_CURRENT_PREFIX" $_UNIQUE_PREFIX_PATH | ||
| set -a _UNIQUE_PREFIX_PATH "$AMENT_CURRENT_PREFIX" | ||
| end | ||
|
|
||
| # Source local_setup.fish for each prefix in order. | ||
| for _prefix_path in $_UNIQUE_PREFIX_PATH | ||
| set -gx AMENT_CURRENT_PREFIX "$_prefix_path" | ||
| if test -f "$_prefix_path/local_setup.fish" | ||
| if test -n "$AMENT_TRACE_SETUP_FILES" | ||
| echo "# source \"$_prefix_path/local_setup.fish\"" | ||
| end | ||
| source "$_prefix_path/local_setup.fish" | ||
| end | ||
| end | ||
|
|
||
| set -e AMENT_CURRENT_PREFIX | ||
| set -e _UNIQUE_PREFIX_PATH | ||
| set -e _parent_index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.