fix(fish): clean up variables (#350)

* use `status dirname` builtin to save 1 dirname call
* use builtin test function instead of [ command
* use local scoping for INSTALL_DIR variable (and make it lowercase to
  indicate such change)

Ref: https://fishshell.com/docs/current/cmds/test.html
This commit is contained in:
Hoang Nguyen 2024-02-07 04:26:53 +00:00 committed by GitHub
parent cf447a64aa
commit 2b58a2e6a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,10 @@
# MIT (c) Chris Apple
set INSTALL_DIR (dirname (dirname (status -f)))
set -x FORGIT_INSTALL_DIR "$INSTALL_DIR/conf.d"
set -l install_dir (dirname (status dirname))
set -x FORGIT_INSTALL_DIR "$install_dir/conf.d"
set -x FORGIT "$FORGIT_INSTALL_DIR/bin/git-forgit"
if [ ! -e "$FORGIT" ]
set -x FORGIT_INSTALL_DIR "$INSTALL_DIR/vendor_conf.d"
if not test -e "$FORGIT"
set -x FORGIT_INSTALL_DIR "$install_dir/vendor_conf.d"
set -x FORGIT "$FORGIT_INSTALL_DIR/bin/git-forgit"
end