From 3cb2c1bce5c8eab266772d3010affc0992aeec31 Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:11:45 +0800 Subject: [PATCH] feat(fish): add `code` wrapper --- programs/fish.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/programs/fish.nix b/programs/fish.nix index d9ec00d..f9e9262 100644 --- a/programs/fish.nix +++ b/programs/fish.nix @@ -10,13 +10,21 @@ in { functions = { take = '' set dir $argv[1] - if [ -z "$dir" ] - echo "QHAR?!?!?!" + if test -z "$dir" return 1 end - mkdir "$dir" + + mkdir -p "$dir" cd "$dir" ''; + + code = '' + if test -d "$argv[1]" or test -f "$argv[1]" + open -a "Visual Studio Code" "$argv[1]" + else + "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" $argv + end + ''; }; };