zsh: now sitepath() can take arguments for fd

This commit is contained in:
PowerUser64 2021-10-01 02:58:13 -07:00
parent f03d45fb4b
commit e831758bee

13
.zshrc
View file

@ -232,14 +232,15 @@
fi
}
# TODO: encode the url to fix things like spaces using something like https://stackoverflow.com/a/10660730/11162605
# usage: sitepath <path to file>
# usage: sitepath <file to find>
# usage: sitepath
# usage: sitepath <fd commands> -- you can search with 'fd' if you put in a command
sitepath() {
# usage: sitepath <path to file>
# usage: sitepath <file to find>
# usage: sitepath
# If there is no input, make the input be the current directory
# If there is no input, make the input the current directory
[ -z ${1+x} ] && 1="$(pwd)"
FILEPATH="$(([ -e "$1" ] && readlink -f "$1") || fd "$1" /home/blake/docker/blakenorth.net/site)"
FILEPATH="$(([ -e "$1" ] && readlink -f "$1") || fd $@ /home/blake/docker/blakenorth.net/site)"
echo "$FILEPATH" | grep -o 'site.*' | sed 's+^site+https://blakenorth.net+g'
}