diff --git a/config/fish/fish_plugins b/config/fish/fish_plugins index 47bc70c..e3e5237 100644 --- a/config/fish/fish_plugins +++ b/config/fish/fish_plugins @@ -3,7 +3,6 @@ jorgebucaran/nvm.fish ilancosman/tide@v6 jethrokuan/z halostatue/fish-macos@v7 -ehfive/fish-bash2env jgusta/paths danhper/fish-ssh-agent halostatue/fish-brew@v3 diff --git a/config/fish/functions/__bash2env.sh b/config/fish/functions/__bash2env.sh deleted file mode 100755 index 94ddd44..0000000 --- a/config/fish/functions/__bash2env.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2022 Huang-Huang Bao -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# shellcheck disable=SC2076 -set -e - -disallowd_vars_arr=( - _ - fish_kill_signal - fish_killring - fish_pid - history - hostname - PWD - pipestatus - SHLVL - status - status_generation - version -) -disallowd_vars=" ${disallowd_vars_arr[*]} " - -fish_escape() { - value="${1//\\/\\\\}" - value="${value//\'/\\\'}" - echo "'${value}'" -} - -flag_impure="$__FISH_BASH2ENV_IMPURE" -unset __FISH_BASH2ENV_IMPURE - -if [[ -z "$flag_impure" ]]; then - old_env=" $(env -0 | tr '\0' ' ') " -fi - -eval_status= -eval "$*" 1>&2 || eval_status=$? - -env -0 | while IFS= read -rs -d $'\0' line; do - if [[ -z "$flag_impure" && "${old_env}" =~ " ${line} " ]]; then - continue - fi - - name="${line%%=*}" - if [[ "${disallowd_vars}" =~ " ${name} " ]]; then - continue - fi - - value="$(fish_escape "${line#*=}")" - echo "set -gx ${name} ${value}" -done - -exit $eval_status diff --git a/config/fish/functions/bash2env.fish b/config/fish/functions/bash2env.fish deleted file mode 100644 index 39a7e6c..0000000 --- a/config/fish/functions/bash2env.fish +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2022 Huang-Huang Bao -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -function bash2env -d "Import environment variables modified by given bash command" - argparse --stop-nonopt h/help i/impure -- $argv - or set argv - - function _print_usage - echo 'Usage:' \ - (set_color $fish_color_command)'bash2env' \ - (set_color $fish_color_normal)'[-i/--impure]' \ - (set_color $fish_color_param)"" - end - - if test -n "$_flag_help" - _print_usage - return - end - if test (count $argv) -eq 0 - _print_usage - return 22 - end - - if test -n "$_flag_impure" - set _flag_impure 1 - end - - set -l DIR (dirname (status -f)) - __FISH_BASH2ENV_IMPURE=$_flag_impure command \ - bash $DIR/__bash2env.sh $argv | source - - for code in $pipestatus - if test $code != 0 - return $code - end - end -end