Fix sudo fish shell integration

Set sudo_has_sudoedit_flags scope to --function.
This commit is contained in:
m154k1
2025-01-21 17:37:28 +02:00
committed by GitHub
parent 5cb2fa6f75
commit 25ccdfe495

View File

@ -71,11 +71,11 @@ function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration"
and test -n "$TERMINFO"; and test "file" = (type -t sudo 2> /dev/null; or echo "x") and test -n "$TERMINFO"; and test "file" = (type -t sudo 2> /dev/null; or echo "x")
# Wrap `sudo` command to ensure Ghostty terminfo is preserved # Wrap `sudo` command to ensure Ghostty terminfo is preserved
function sudo -d "Wrap sudo to preserve terminfo" function sudo -d "Wrap sudo to preserve terminfo"
set --local sudo_has_sudoedit_flags "no" set --function sudo_has_sudoedit_flags "no"
for arg in $argv for arg in $argv
# Check if argument is '-e' or '--edit' (sudoedit flags) # Check if argument is '-e' or '--edit' (sudoedit flags)
if string match -q -- "-e" "$arg"; or string match -q -- "--edit" "$arg" if string match -q -- "-e" "$arg"; or string match -q -- "--edit" "$arg"
set --local sudo_has_sudoedit_flags "yes" set --function sudo_has_sudoedit_flags "yes"
break break
end end
# Check if argument is neither an option nor a key-value pair # Check if argument is neither an option nor a key-value pair