Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Add newline to regular `wt` output in shell integrations
Maximilian Roos80bca2c72abb
diff --git a/templates/bash.sh b/templates/bash.shindex ce127b9b6..25164883a 100644--- a/templates/bash.sh+++ b/templates/bash.sh@@ -26,8 +26,8 @@ if command -v wt >/dev/null 2>&1; then# EXEC directive - extract command (may contain newlines)exec_cmd="${chunk#__WORKTRUNK_EXEC__}"else- # Regular output - print it (preserving newlines)- printf '%s' "$chunk"+ # Regular output - print it with newline+ printf '%s\n' "$chunk"fidone < <(command "$_WORKTRUNK_CMD" "$@"; echo "$?" > "$exit_code_file")diff --git a/templates/fish.fish b/templates/fish.fishindex 95327dc92..d1ad5c208 100644--- a/templates/fish.fish+++ b/templates/fish.fish@@ -59,11 +59,11 @@ if type -q {{ cmd_prefix }}echo "[DEBUG] EXEC directive: $exec_cmd" >&2endelse if test -n "$chunk"- # Regular output - print it (preserving newlines)+ # Regular output - print it with newlineif test $debug_mode -eq 1echo "[DEBUG] Message chunk" >&2end- printf '%s' $chunk+ printf '%s\n' $chunkendend < (begin; command $_WORKTRUNK_CMD $argv; echo $status > $exit_code_file; end | psub)diff --git a/templates/nushell.nu b/templates/nushell.nuindex 32b70ad68..84f3607ad 100644--- a/templates/nushell.nu+++ b/templates/nushell.nu@@ -24,8 +24,8 @@ if (which wt | is-not-empty) {# TODO: Use str replace instead of hard-coded offset (fragile if prefix changes)$exec_cmd = ($chunk | str substring 18..)} else if ($chunk | str length) > 0 {- # Regular output - print it (preserving newlines)- print -n $chunk+ # Regular output - print it with newline+ print $chunk}}diff --git a/templates/powershell.ps1 b/templates/powershell.ps1index 9e8dc615e..0432c0bee 100644--- a/templates/powershell.ps1+++ b/templates/powershell.ps1@@ -30,9 +30,9 @@ if (Get-Command wt -ErrorAction SilentlyContinue) {# EXEC directive - extract command (may contain newlines)$execCmd = $chunk -replace '^__WORKTRUNK_EXEC__', ''} elseif ($chunk) {- # Regular output - write it (preserving newlines)+ # Regular output - write it with newline# TODO: Use Write-Output instead of Write-Host for redirectable output- Write-Host -NoNewline $chunk+ Write-Host $chunk}}diff --git a/templates/xonsh.xsh b/templates/xonsh.xshindex 6648d851e..bc6e1165e 100644--- a/templates/xonsh.xsh+++ b/templates/xonsh.xsh@@ -28,8 +28,8 @@ if shutil.which("wt") is not None:# TODO: Use str.replace instead of hard-coded offset (fragile if prefix changes)exec_cmd = chunk[18:] # Remove prefixelif chunk:- # Regular output - print it (preserving newlines)- print(chunk, end='')+ # Regular output - print it with newline+ print(chunk)# Execute command if one was specifiedif exec_cmd:diff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snapindex 176e8301b..1d7e1ad74 100644--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap@@ -14,7 +14,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpig4dTj/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpiVd1K8/test-config.toml---success: trueexit_code: 0@@ -47,8 +47,8 @@ if command -v wt >/dev/null 2>&1; then# EXEC directive - extract command (may contain newlines)exec_cmd="${chunk#__WORKTRUNK_EXEC__}"else- # Regular output - print it (preserving newlines)- printf '%s' "$chunk"+ # Regular output - print it with newline+ printf '%s\n' "$chunk"fidone < <(command "$_WORKTRUNK_CMD" "$@"; echo "$?" > "$exit_code_file")diff --git a/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snap b/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snapindex a74862b7e..6c678bec8 100644--- a/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snap+++ b/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snap@@ -16,7 +16,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpXFi2Dc/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpehaTjD/test-config.toml---success: trueexit_code: 0@@ -49,8 +49,8 @@ if command -v wt >/dev/null 2>&1; then# EXEC directive - extract command (may contain newlines)exec_cmd="${chunk#__WORKTRUNK_EXEC__}"else- # Regular output - print it (preserving newlines)- printf '%s' "$chunk"+ # Regular output - print it with newline+ printf '%s\n' "$chunk"fidone < <(command "$_WORKTRUNK_CMD" "$@"; echo "$?" > "$exit_code_file")diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snapindex b6caccaa4..8b4c5bde0 100644--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap@@ -14,7 +14,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpSv8CTr/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpZgorwu/test-config.toml---success: trueexit_code: 0@@ -80,11 +80,11 @@ if type -q wtecho "[DEBUG] EXEC directive: $exec_cmd" >&2endelse if test -n "$chunk"- # Regular output - print it (preserving newlines)+ # Regular output - print it with newlineif test $debug_mode -eq 1echo "[DEBUG] Message chunk" >&2end- printf '%s' $chunk+ printf '%s\n' $chunkendend < (begin; command $_WORKTRUNK_CMD $argv; echo $status > $exit_code_file; end | psub)diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snapindex c36a20d0d..4930f074e 100644--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap@@ -14,7 +14,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpTpN3ZR/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpmY4L7S/test-config.toml---success: trueexit_code: 0@@ -47,8 +47,8 @@ if command -v wt >/dev/null 2>&1; then# EXEC directive - extract command (may contain newlines)exec_cmd="${chunk#__WORKTRUNK_EXEC__}"else- # Regular output - print it (preserving newlines)- printf '%s' "$chunk"+ # Regular output - print it with newline+ printf '%s\n' "$chunk"fidone < <(command "$_WORKTRUNK_CMD" "$@"; echo "$?" > "$exit_code_file")diff --git a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_stdout_stderr_ordering.snap b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_stdout_stderr_ordering.snapindex 0951aa78b..17f3aca88 100644--- a/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_stdout_stderr_ordering.snap+++ b/tests/snapshots/integration__integration_tests__merge__merge_pre_merge_check_stdout_stderr_ordering.snap@@ -16,7 +16,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpUgOch7/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmp9QAkUl/test-config.toml---success: trueexit_code: 0@@ -33,7 +33,7 @@ exit_code: 0π [36mRebasing onto [1m[36mmain[0m...[0mπ [36mPushing 1 commit to [1m[36mmain[0m @ [SHA][0m-* [33me647aed[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature file+* [33ma334407[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature[m[33m)[m Add feature filefeature.txt | 1 [32m+[m1 file changed, 1 insertion(+)