Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Improve Fish shell integration for directory changes

Maximilian Roose25ddf3de995
diff --git a/templates/fish.fish b/templates/fish.fish
index b7470bac3..4355b76e5 100644
--- a/templates/fish.fish
+++ b/templates/fish.fish
@@ -6,10 +6,10 @@ function _wt_exec
set -l exit_code $status
# Parse output line by line
- for line in $output
+ for line in (string split \n -- $output)
if string match -q '__WORKTRUNK_CD__*' -- $line
# Extract path and change directory
- cd (string sub -s 18 -- $line)
+ cd (string replace '__WORKTRUNK_CD__' '' -- $line)
else
# Regular output - print it
echo $line
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index 6ac8f0689..764e189e8 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -26,10 +26,10 @@ function _wt_exec
set -l exit_code $status
# Parse output line by line
- for line in $output
+ for line in (string split \n -- $output)
if string match -q '__WORKTRUNK_CD__*' -- $line
# Extract path and change directory
- cd (string sub -s 18 -- $line)
+ cd (string replace '__WORKTRUNK_CD__' '' -- $line)
else
# Regular output - print it
echo $line
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish_prompt_hook.snap b/tests/snapshots/integration__integration_tests__init__init_fish_prompt_hook.snap
index 0e11af37f..43f00a8b8 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish_prompt_hook.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish_prompt_hook.snap
@@ -28,10 +28,10 @@ function _wt_exec
set -l exit_code $status
# Parse output line by line
- for line in $output
+ for line in (string split \n -- $output)
if string match -q '__WORKTRUNK_CD__*' -- $line
# Extract path and change directory
- cd (string sub -s 18 -- $line)
+ cd (string replace '__WORKTRUNK_CD__' '' -- $line)
else
# Regular output - print it
echo $line