Skip to content

Commit 35e9d20

Browse files
committed
powerline-go: fix PROMPT_COMMAND duplicate in bash initialization
1 parent c613ac1 commit 35e9d20

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

modules/programs/powerline-go.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ in
165165
}
166166
167167
if [ "$TERM" != "linux" ]; then
168-
PROMPT_COMMAND="_update_ps1;$PROMPT_COMMAND"
168+
if [[ ";''${PROMPT_COMMAND:-};" != *";_update_ps1;"* ]]; then
169+
PROMPT_COMMAND="_update_ps1''${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
170+
fi
169171
fi
170172
'';
171173

tests/modules/programs/powerline-go/bash.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
assertFileContains \
2727
home-files/.bashrc \
2828
'/bin/powerline-go -error $old_exit_status -shell bash -modules nix-shell -newline -path-aliases \~/project/foo=prj-foo -ignore-repos /home/me/project1,/home/me/project2'
29+
assertFileContains \
30+
home-files/.bashrc \
31+
'if [[ ";''${PROMPT_COMMAND:-};" != *";_update_ps1;"* ]]; then'
2932
'';
3033
}

0 commit comments

Comments
 (0)