“Changes”

This commit is contained in:
Austen Adler 2016-10-06 13:16:35 -04:00
parent 1357592606
commit 94df38d091
No known key found for this signature in database
GPG Key ID: 7ECEE590CCDFE3F1
2 changed files with 20 additions and 13 deletions

View File

@ -274,7 +274,7 @@ endif
"Quickly make tables in vim | https://github.com/godlygeek/tabular
Plug 'sirver/UltiSnips'
"Adds snippets | https://github.com/sirver/UltiSnips
Plug 'honza/vim-snippets'
Plug 'https://austenwares.com/gogs/vim/vim-snippets'
"More snippets | https://github.com/honza/vim-snippets
Plug 'othree/eregex.vim'
"Real regexes in vim | https://github.com/othree/eregex.vim

View File

@ -1,16 +1,16 @@
REPO="aw:borg"
b-list() {
local REPO="aw:borg"
if [[ -z "$1" ]]; then
column -t <(borg list "$REPO")
else
borg list "$REPO"::"$1"
borg list "$REPO::$1"
fi
}
b-delete() {
while (( $# > 0 )); do
if [[ ! -z "$1" ]]; then
echo "Deleting... $1"
borg delete "$REPO"::"$1"
borg delete "$REPO::$1"
fi
shift
done
@ -23,10 +23,12 @@ b-create() {
$SUDO /home/stonewareslord/syncthing/me/backup/$(hostname)/backup
}
b-rename() {
borg rename -v "$REPO"::"$1" "$2"
local REPO="aw:borg"
borg rename -v "$REPO::$1" "$2"
}
b-info() {
borg info "$REPO"::"$1"
local REPO="aw:borg"
borg info "$REPO::$1"
}
b-diff() {
REPO="aw:borg"
@ -35,8 +37,6 @@ b-diff() {
read ID1
echo -n "Second ID: "
read ID2
if [ -z "$ID2" ] || [ -z "$ID2" ]; then
echo "No id" >&2
return 1
@ -59,8 +59,8 @@ b-diff() {
echo "FILE_SIZE_LIST2: $FILE_SIZE_LIST2"
echo "COMPLETED_FILE1: $COMPLETED_FILE1"
echo "COMPLETED_FILE2: $COMPLETED_FILE2"
borg list --short "$REPO"::"$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
borg list --short "$REPO"::"$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
borg list --short "$REPO::$ID1" | pv -N "Getting List 1" > "$FILE_LIST1"
borg list --short "$REPO::$ID2" | pv -N "Getting List 2" > "$FILE_LIST2"
# Find differences and calculate them
diff <(pv -cN "List 1 Diff" "$FILE_LIST1") <(pv -cN "List 1 Diff" "$FILE_LIST2") > >(ag '^<' | perl -pe 's/^< //' > "$A_DIFFS") > >(ag '^>' | perl -pe 's/^> //' > "$B_DIFFS")
# Truncate everything
@ -101,7 +101,7 @@ b-size() {
echo "FILE_LIST: $FILE_LIST"
echo "FILE_SIZE_LIST: $FILE_SIZE_LIST"
echo "COMPLETED_FILE: $COMPLETED_FILE"
borg list --short "$REPO"::"$ID" | pv -N "Getting List" > "$FILE_LIST"
borg list --short "$REPO::$ID" | pv -N "Getting List" > "$FILE_LIST"
while read i
do
test -f /"$i" && du -sh /"$i" 2>/dev/null >> "$FILE_SIZE_LIST"
@ -111,6 +111,13 @@ b-size() {
:>"$FILE_SIZE_LIST"
less "$COMPLETED_FILE"
}
b-cmd() {
echo "$REPO"
b-extract() {
local REPO="aw:borg"
local BACKUP="$1"
shift
borg extract "$REPO::$BACKUP" $*
}
b-cmd() {
local REPO="aw:borg"
echo "$REPO" $*
}