aboutsummaryrefslogtreecommitdiff
path: root/.config/fish/functions/create_fish_dotenv.fish
diff options
context:
space:
mode:
authorkj-sh6042024-07-17 22:27:14 -0400
committerkj-sh6042024-07-17 22:27:14 -0400
commitfe0f355277b220f304b2e58695349add20741e91 (patch)
treef140ce64ac2bc7bf124a74bf81ca0bdb6c4446ee /.config/fish/functions/create_fish_dotenv.fish
parent311ea8ad7c5049ac9efec309b35073b19638054b (diff)
feat: new POSIX and fish functions
Diffstat (limited to '.config/fish/functions/create_fish_dotenv.fish')
-rw-r--r--.config/fish/functions/create_fish_dotenv.fish17
1 files changed, 17 insertions, 0 deletions
diff --git a/.config/fish/functions/create_fish_dotenv.fish b/.config/fish/functions/create_fish_dotenv.fish
new file mode 100644
index 0000000..0574b53
--- /dev/null
+++ b/.config/fish/functions/create_fish_dotenv.fish
@@ -0,0 +1,17 @@
+function create_fish_dotenv
+ if test -f .env
+ echo "# Auto-generated .env.fish file" > .env.fish
+ cat .env | while read line
+ if not string match -qr '^\s*#' -q $line
+ if not string match -qr '^\s*$' -q $line
+ set key (string split -m 1 '=' $line)[1]
+ set value (string split -m 1 '=' $line)[2]
+ echo "set -x $key $value" >> .env.fish
+ end
+ end
+ end
+ echo ".env.fish file created successfully."
+ else
+ echo ".env file not found in current directory."
+ end
+end