From e10ea224fd1c8fdd039764fbc160070dfa77fdf6 Mon Sep 17 00:00:00 2001 From: Different55 Date: Tue, 29 Apr 2025 08:44:42 -0400 Subject: [PATCH] Add first batch of scripts --- ,rmount.fish | 4 ++++ ,upload.fish | 10 ++++++++++ ,usage.fish | 25 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 ,rmount.fish create mode 100644 ,upload.fish create mode 100644 ,usage.fish diff --git a/,rmount.fish b/,rmount.fish new file mode 100644 index 0000000..adf9c8c --- /dev/null +++ b/,rmount.fish @@ -0,0 +1,4 @@ +function ,rmount --wraps='rclone mount' --description 'mounts the given rclone remote (plus path) at the given name in the ~/Remotes/ folder' + mkdir -p "$HOME/Remote/$argv[2]" + rclone mount --daemon --vfs-cache-mode=full --vfs-fast-fingerprint --volname "$argv[2]" "$argv[1]" "$HOME/Remote/$argv[2]" +end diff --git a/,upload.fish b/,upload.fish new file mode 100644 index 0000000..4a3d02d --- /dev/null +++ b/,upload.fish @@ -0,0 +1,10 @@ +function ,upload --wraps='rclone copy' --description 'Upload files to jaromino.com' + set file (basename "$argv") + set file (string escape --style=url "$file") + rclone copy "$argv" Jaromino:/home/public/jaromino.com/Files/ -P --ignore-existing + or return $status + + set url (printf "https://jaromino.com/Files/%s" "$file") + echo "$url" | pbcopy + printf "%s\n" "$url" +end diff --git a/,usage.fish b/,usage.fish new file mode 100644 index 0000000..96db025 --- /dev/null +++ b/,usage.fish @@ -0,0 +1,25 @@ +function ,usage --wraps=du --description 'get disk usage of current working directory' + argparse 'a/all' 'h/help' -- $argv + if set -ql _flag_h + echo "Usage: ,usage [-h | --help] [-a | -all] [directory]" + echo " -h Print this help" + echo " -a Scan all files and folders (including hidden ones)" + echo "" + echo "If no directory is provided, the current directory is assumed" + return + end + + set path "." + if test -n "$argv" + set path "$argv" + end + + set paths "$path"/* + + if set -ql _flag_a + set -a paths "$path"/.* + end + + du -hs $paths | sort -h + +end -- knotmirror 0.0.1