zsh: realized some things need to be functions
By that, I mean things that change my working directory need to be functions
This commit is contained in:
parent
cba8e92e1d
commit
06ab216290
11 changed files with 93 additions and 94 deletions
|
@ -6,18 +6,18 @@
|
|||
# usage: sitepath
|
||||
# usage: sitepath <fd commands> -- you can search with 'fd' if you put in a command
|
||||
|
||||
# account for if there is no urlencode command
|
||||
URLENCODE=urlencode
|
||||
if ! command -v urlencode > /dev/null 2>&1;then
|
||||
URLENCODE=cat
|
||||
fi
|
||||
# If there is no input, make the input the current directory
|
||||
[ -z ${1+x} ] && 1="$(pwd)"
|
||||
FILEPATH="$(([ -e "$1" ] && readlink -f "$1") || fd $@ /home/blake/docker/blakenorth.net/site)"
|
||||
# account for if there is no urlencode command
|
||||
URLENCODE=urlencode
|
||||
if ! command -v urlencode > /dev/null 2>&1;then
|
||||
URLENCODE=cat
|
||||
fi
|
||||
# If there is no input, make the input the current directory
|
||||
[ -z ${1+x} ] && 1="$(pwd)"
|
||||
FILEPATH="$(([ -e "$1" ] && readlink -f "$1") || fd $@ /home/blake/docker/blakenorth.net/site)"
|
||||
|
||||
# change all file paths into urls
|
||||
echo "$FILEPATH" |
|
||||
grep -o 'site.*' |
|
||||
sed 's+^site+https://blakenorth.net+g' |
|
||||
$URLENCODE # if you need this, I am using dead10ck/urlencode (cargo install urlencode)
|
||||
# change all file paths into urls
|
||||
echo "$FILEPATH" |
|
||||
grep -o 'site.*' |
|
||||
sed 's+^site+https://blakenorth.net+g' |
|
||||
$URLENCODE # if you need this, I am using dead10ck/urlencode (cargo install urlencode)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue