zsh: now sitepath() can take arguments for fd
This commit is contained in:
parent
f03d45fb4b
commit
e831758bee
1 changed files with 7 additions and 6 deletions
13
.zshrc
13
.zshrc
|
@ -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'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue