Grab bag of random fish scripts and functions I've collected
1function ,usage --wraps=du --description 'get disk usage of current working directory'
2 argparse 'a/all' 'h/help' -- $argv
3 if set -ql _flag_h
4 echo "Usage: ,usage [-h | --help] [-a | -all] [directory]"
5 echo " -h Print this help"
6 echo " -a Scan all files and folders (including hidden ones)"
7 echo ""
8 echo "If no directory is provided, the current directory is assumed"
9 return
10 end
11
12 set path "."
13 if test -n "$argv"
14 set path "$argv"
15 end
16
17 set paths "$path"/*
18
19 if set -ql _flag_a
20 set -a paths "$path"/.*
21 end
22
23 du -hs $paths | sort -h
24
25end