From 19f0fc7c09915e92f1da0b1c4906085c56f9832c Mon Sep 17 00:00:00 2001
From: Hoang Nguyen <folliekazetani@protonmail.com>
Date: Wed, 7 Feb 2024 00:00:00 +0700
Subject: [PATCH] fix(fish): clean up variables

* 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
---
 conf.d/forgit.plugin.fish | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish
index 48e31821..1c91359e 100644
--- a/conf.d/forgit.plugin.fish
+++ b/conf.d/forgit.plugin.fish
@@ -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