chore: make fish files executable

This commit is contained in:
2025-10-23 23:44:05 +03:00
parent 0bd72c6d51
commit 3f2d1b85ed
18 changed files with 299 additions and 320 deletions

View File

@@ -2,8 +2,8 @@
# Dependencies: tmux
# Usage: open-tmux
function open-tmux --wraps='tmux attach-session -t main || tmux new-session -s main' --description 'open tmux session'
# Check if not in an SSH session and not already in a tmux session
if test -z "$SSH_TTY"; and not set -q TMUX
command tmux attach-session -t main || command tmux new-session -s main
end
# Check if not in an SSH session and not already in a tmux session
if test -z "$SSH_TTY"; and not set -q TMUX
command tmux attach-session -t main || command tmux new-session -s main
end
end

View File

@@ -99,7 +99,7 @@ end
function __phpenv_find_version_file -a phpenv_filename
set -l phpenv_dir (pwd)
while test "$phpenv_dir" != "/"
while test "$phpenv_dir" != /
if test -f "$phpenv_dir/$phpenv_filename"
echo "$phpenv_dir/$phpenv_filename"
return
@@ -126,13 +126,13 @@ function __phpenv_parse_composer_version
end
set -l phpenv_platform_php (jq -r '.config.platform.php // empty' composer.json 2>/dev/null)
if test $status -eq 0 -a -n "$phpenv_platform_php" -a "$phpenv_platform_php" != "null"
if test $status -eq 0 -a -n "$phpenv_platform_php" -a "$phpenv_platform_php" != null
echo $phpenv_platform_php
return
end
set -l phpenv_require_php (jq -r '.require.php // empty' composer.json 2>/dev/null)
if test $status -eq 0 -a -n "$phpenv_require_php" -a "$phpenv_require_php" != "null"
if test $status -eq 0 -a -n "$phpenv_require_php" -a "$phpenv_require_php" != null
__phpenv_parse_semver_constraint $phpenv_require_php
return
end
@@ -189,7 +189,7 @@ set -g __phpenv_version_cache_time 0
function __phpenv_get_version_info
set -l current_time (date +%s)
set -l cache_duration 300 # 5 minutes
set -l cache_duration 300 # 5 minutes
# Return cached version if still valid
if test -n "$__phpenv_version_cache"
@@ -267,7 +267,7 @@ function __phpenv_list_installed
continue
end
if test "$phpenv_basename" = "php"
if test "$phpenv_basename" = php
set -l phpenv_latest (__phpenv_parse_version_field "latest" "8.4")
set -a phpenv_versions $phpenv_latest
else if echo $phpenv_basename | grep -qE '^php@[0-9]+\.[0-9]+$'
@@ -284,9 +284,9 @@ end
function __phpenv_resolve_version_alias -a phpenv_version
switch $phpenv_version
case latest
__phpenv_parse_version_field "latest" "8.4"
__phpenv_parse_version_field latest "8.4"
case nightly
__phpenv_parse_version_field "nightly" "8.5"
__phpenv_parse_version_field nightly "8.5"
case '8.x'
__phpenv_parse_version_field "8.x" "8.4"
case '7.x'
@@ -302,7 +302,7 @@ function __phpenv_get_formula_name -a phpenv_version
set -l phpenv_latest_version (__phpenv_parse_version_field "latest" "8.4")
if test "$phpenv_version" = "$phpenv_latest_version"
echo "shivammathur/php/php"
echo shivammathur/php/php
else
echo "shivammathur/php/php@$phpenv_version"
end
@@ -475,7 +475,7 @@ function __phpenv_use
set -l phpenv_version $argv[1]
# Handle special case: restore system PHP
if test "$phpenv_version" = "system"
if test "$phpenv_version" = system
__phpenv_restore_system_path
echo "Restored system PHP"
return 0
@@ -492,7 +492,7 @@ function __phpenv_use
end
if not __phpenv_is_version_installed $phpenv_version
if test "$(__phpenv_config_get auto-install)" = "true"
if test "$(__phpenv_config_get auto-install)" = true
__phpenv_install $phpenv_version
else
echo "PHP $phpenv_version is not installed. Install with: phpenv install $phpenv_version"
@@ -514,7 +514,7 @@ function __phpenv_local -a phpenv_version
return 1
end
echo $phpenv_version > .php-version
echo $phpenv_version >.php-version
echo "Set local PHP version to $phpenv_version"
end
@@ -587,7 +587,7 @@ function __phpenv_get_tap_versions
continue
end
if test "$phpenv_clean_name" = "php"
if test "$phpenv_clean_name" = php
set -a phpenv_versions "$phpenv_latest_version (latest)"
else if echo $phpenv_clean_name | grep -qE '^php@[0-9]+\.[0-9]+$'
set -l phpenv_version (echo $phpenv_clean_name | sed 's/php@//')
@@ -717,7 +717,7 @@ function __phpenv_config_get -a phpenv_key
end
end
if test "$argv[2]" = "--verbose"
if test "$argv[2]" = --verbose
if test -n "$phpenv_value"
echo "$phpenv_key = $phpenv_value (from $phpenv_source)"
else
@@ -872,15 +872,14 @@ function __phpenv_get_available_extensions
return 1
end
brew tap-info shivammathur/extensions --json 2>/dev/null | \
jq -r '.[]|(.formula_names[]?)' 2>/dev/null
brew tap-info shivammathur/extensions --json 2>/dev/null | jq -r '.[]|(.formula_names[]?)' 2>/dev/null
end
function __phpenv_extension_available -a phpenv_extension phpenv_version
set -l phpenv_available_extensions (__phpenv_get_available_extensions)
if test -z "$phpenv_available_extensions"
return 0 # Assume available if can't check
return 0 # Assume available if can't check
end
for phpenv_ext_formula in $phpenv_available_extensions
@@ -936,7 +935,7 @@ function __phpenv_extensions_list
for phpenv_ext_dir in $phpenv_cellar_path/*@$phpenv_version
if test -d $phpenv_ext_dir
set -l phpenv_ext_name (basename $phpenv_ext_dir | sed "s/@$phpenv_version//")
if test "$phpenv_ext_name" != "php"
if test "$phpenv_ext_name" != php
echo " $phpenv_ext_name"
end
end
@@ -983,7 +982,7 @@ function __phpenv_auto_switch --on-variable PWD
end
set -l phpenv_auto_switch (__phpenv_config_get auto-switch)
if test "$phpenv_auto_switch" = "false"
if test "$phpenv_auto_switch" = false
return 0
end
@@ -1006,7 +1005,7 @@ function __phpenv_auto_switch --on-variable PWD
set -g PHPENV_LAST_SWITCH_TIME $phpenv_current_time
else
set -l phpenv_auto_install (__phpenv_config_get auto-install)
if test "$phpenv_auto_install" = "true"
if test "$phpenv_auto_install" = true
echo "Auto-installing PHP $phpenv_new_version..."
if phpenv install "$phpenv_new_version"
set -g PHPENV_LAST_SWITCH_TIME $phpenv_current_time
@@ -1052,7 +1051,7 @@ function __phpenv_help
end
function __phpenv_validate_boolean -a phpenv_value
test "$phpenv_value" = "true" -o "$phpenv_value" = "false"
test "$phpenv_value" = true -o "$phpenv_value" = false
end
function __phpenv_validate_version -a phpenv_version