refactor(shell-integration): refactor to make cases alphabetical

also fix: build errors
also fix: name mismatch (GHOSTTY_FISH_XDG_DIR -> GHOSTTY_INTEGRATION_DIR)
also refactor elvish file to evade unobvious returns
This commit is contained in:
ilk
2024-05-17 18:02:03 +03:00
committed by Mitchell Hashimoto
parent 7377ca8917
commit 2863d2c148

View File

@ -6,7 +6,7 @@
function ghostty_restore_xdg_data_dir -d "restore the original XDG_DATA_DIR value" function ghostty_restore_xdg_data_dir -d "restore the original XDG_DATA_DIR value"
# If we don't have our own data dir then we don't need to do anything. # If we don't have our own data dir then we don't need to do anything.
if not set -q GHOSTTY_FISH_XDG_DIR if not set -q GHOSTTY_INTEGRATION_DIR
return return
end end
@ -19,7 +19,7 @@ function ghostty_restore_xdg_data_dir -d "restore the original XDG_DATA_DIR valu
set --function --path xdg_data_dirs "$XDG_DATA_DIRS" set --function --path xdg_data_dirs "$XDG_DATA_DIRS"
# If our data dir is in the list then remove it. # If our data dir is in the list then remove it.
if set --function index (contains --index "$GHOSTTY_FISH_XDG_DIR" $xdg_data_dirs) if set --function index (contains --index "$GHOSTTY_INTEGRATION_DIR" $xdg_data_dirs)
set --erase --function xdg_data_dirs[$index] set --erase --function xdg_data_dirs[$index]
end end
@ -30,7 +30,7 @@ function ghostty_restore_xdg_data_dir -d "restore the original XDG_DATA_DIR valu
set --erase --global XDG_DATA_DIRS set --erase --global XDG_DATA_DIRS
end end
set --erase GHOSTTY_FISH_XDG_DIR set --erase GHOSTTY_INTEGRATION_DIR
end end
function ghostty_exit -d "exit the shell integration setup" function ghostty_exit -d "exit the shell integration setup"