From f97304d44fcfd80f9e4b7abc5fac5ab2c1db0771 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Tue, 18 Jun 2019 12:13:09 -0400 Subject: [PATCH] fish: add quicklink commands --- applications/fish | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/applications/fish b/applications/fish index 4f2819b..d627f5c 100644 --- a/applications/fish +++ b/applications/fish @@ -22,10 +22,41 @@ function rebuild $HOME/src/scripts/rebuild.rkt end -function cheat.sh - curl cheat.sh/$argv +function cheat.sh -d 'Grabs a sheet from cheat.sh' -a arg + curl cheat.sh/$arg end complete -c cheat.sh -xa '(curl -s cheat.sh/:list)' +function ql -d 'Changes directory to a quicklink' -a name + if not set -q quicklink_$name name + echo (set_color red)"error: no quicklink named $name"(set_color normal) + return + end + + set name quicklink_$name + + cd $$name +end + +function ql-r -w ql -d 'Removes a quicklink' -a name + if not set -q name + echo (set_color red)"error: not enough arguments"(set_color normal) + return + end + + set -Ue quicklink_$name +end + +function ql-s -d 'Saves the working directory as a quicklink' -a name + if not set -q name + echo (set_color red)"error: not enough arguments"(set_color normal) + return + end + + set -U quicklink_$name $PWD +end + +complete -c ql -xa '(set -U | rg -or \'$1\' \'^quicklink_(.+) \')' + ## EOF