Merge branch 'master' of git.blakenorth.net/home/git/dotfiles
This commit is contained in:
commit
612470d722
3 changed files with 17 additions and 11 deletions
|
@ -100,7 +100,7 @@ alias \
|
||||||
dupd='docker-compose up -d' \
|
dupd='docker-compose up -d' \
|
||||||
ddwn='docker-compose down' \
|
ddwn='docker-compose down' \
|
||||||
dc='docker-compose' \
|
dc='docker-compose' \
|
||||||
occ='docker exec -u www-data nextcloud php occ' \
|
occ='docker exec -u www-data nextcloud php occ --ansi' \
|
||||||
|
|
||||||
# file copying with a progress bar
|
# file copying with a progress bar
|
||||||
alias cpv="rsync -ah --info=progress2"
|
alias cpv="rsync -ah --info=progress2"
|
||||||
|
|
|
@ -1,23 +1,28 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# TODO: encode the url to fix things like spaces using something like https://stackoverflow.com/a/10660730/11162605
|
# Requires: urlencode # if you need this, I am using dead10ck/urlencode (`cargo install urlencode`)
|
||||||
|
|
||||||
# usage: sitepath <path to file>
|
# usage: sitepath <path to file>
|
||||||
# usage: sitepath <file to find>
|
# usage: sitepath <file to find>
|
||||||
# usage: sitepath
|
# usage: sitepath
|
||||||
# usage: sitepath <fd commands> -- you can search with 'fd' if you put in a command
|
# usage: sitepath <fd commands> -- you can search with 'fd' if you put in a command
|
||||||
|
|
||||||
|
BASE_URL="https://blakenorth.net"
|
||||||
|
SITE_DIR="/home/blake/docker/blakenorth.net/site"
|
||||||
|
SEPERATOR='~' # Make this a character you don't use in filenames. It's for sed.
|
||||||
|
|
||||||
# account for if there is no urlencode command
|
# account for if there is no urlencode command
|
||||||
URLENCODE=urlencode
|
URLENCODE=urlencode
|
||||||
if ! command -v urlencode > /dev/null 2>&1;then
|
if ! command -v urlencode > /dev/null 2>&1;then
|
||||||
URLENCODE=cat
|
URLENCODE=cat
|
||||||
fi
|
fi
|
||||||
# If there is no input, make the input the current directory
|
# If there is no input, make the input the current directory
|
||||||
[ -z ${1+x} ] && 1="$(pwd)"
|
[ -z ${1+x} ] && set -- "$(pwd)"
|
||||||
FILEPATH="$(([ -e "$1" ] && readlink -f "$1") || fd $@ /home/blake/docker/blakenorth.net/site)"
|
FILEPATH="$( ([ -e "$1" ] && readlink -f "$1") || fd "$@")"
|
||||||
|
|
||||||
# change all file paths into urls
|
# change all file paths into urls
|
||||||
echo "$FILEPATH" |
|
echo "$FILEPATH" |
|
||||||
grep -o 'site.*' |
|
grep -o 'site.*' |
|
||||||
sed 's+^site+https://blakenorth.net+g' |
|
sed "s${SEPERATOR[0]}^${SITE_DIR##*/}${SEPERATOR[0]}$BASE_URL${SEPERATOR[0]}g" |
|
||||||
$URLENCODE # if you need this, I am using dead10ck/urlencode (cargo install urlencode)
|
$URLENCODE
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ cda() {
|
||||||
echo "$DIR"
|
echo "$DIR"
|
||||||
(cd "$DIR" && $SHELL)
|
(cd "$DIR" && $SHELL)
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
echo "$0: done"
|
echo "$0: done"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue