From 053876bb52dce2a98163d3ff2fd2df6dfd448495 Mon Sep 17 00:00:00 2001 From: grassblock Date: Thu, 8 Aug 2024 12:29:34 +0800 Subject: [PATCH] feat: add fish functions --- .../private_fish/functions/0x.fish | 14 ++++++++++++++ .../private_fish/functions/img2c.fish | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 home/private_dot_config/private_fish/functions/0x.fish create mode 100644 home/private_dot_config/private_fish/functions/img2c.fish diff --git a/home/private_dot_config/private_fish/functions/0x.fish b/home/private_dot_config/private_fish/functions/0x.fish new file mode 100644 index 0000000..705e6ea --- /dev/null +++ b/home/private_dot_config/private_fish/functions/0x.fish @@ -0,0 +1,14 @@ +function 0x --description "upload/shorten to 0x0 services" + switch $argv[1] + case "file" "f" + curl -F "file=@$argv[2]" https://envs.sh + case "i" + curl -F "file=@-" https://envs.sh + case "link" "fl" + curl -F "url=$argv[2]" https://envs.sh + case "shorten" "l" + curl -F "shorten=$argv[2]" https://envs.sh + case "*" + printf "Usage: 0x [file|link|shorten] \n 0x i to read from standard input." + end +end diff --git a/home/private_dot_config/private_fish/functions/img2c.fish b/home/private_dot_config/private_fish/functions/img2c.fish new file mode 100644 index 0000000..28e43b2 --- /dev/null +++ b/home/private_dot_config/private_fish/functions/img2c.fish @@ -0,0 +1,14 @@ +#!/usr/bin/fish +function img2c --description "Upload images to cloud, powered by picgo" + if ! type -t picgo &> /dev/null + set --function PICGO_PATH $HOME/ws/bin/piclist/node_modules/piclist/bin/picgo # change to your picgo binary path if needed + end + if ! test -d $HOME/.picgo -a -d $HOME/.piclist + set --function PICGO_DATA /home/grassblock/ws/bin/piclist/data/ # change to a directory that contains the .picgo / .piclist directory + end + if ! count $argv > /dev/null + echo "please provide a image path" + else + HOME=$PICGO_DATA $PICGO_PATH -s upload $argv[1] + end +end