dot

packages and services management
Log | Files | Refs | README

commit 894bd2de075c2087d32f3c0749c763cd46cf1cc6
parent 3bc4267929ee978a8120de57ce1e1c0b446a4c77
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon,  8 Jan 2018 18:44:26 +0100

intuitive command language: backup, back to ..., backlog

Diffstat:
Mbin/back | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bin/back b/bin/back @@ -8,18 +8,18 @@ sum='b2sum -l 256' [ -r "$BACK/log" ] && log=$BACK/rev/$(sed -n '$ s/[^ ]* // p' "$BACK/log") case $1 in -(new) +(up) find . -type f | sort | while read -r path do [ "$log" -nt "$path" ] && grep -F "$path" "$log" || $sum "$path" done | tee "$BACK/new" | while read -r hash path - do [ -f "$BACK/obj/$hash" ] || xz -ck "$path" > "$BACK/obj/$hash.xz" + do [ -f "$BACK/obj/$hash.xz" ] || xz -ck "$path" > "$BACK/obj/$hash.xz" done rev=$($sum "$BACK/new" | sed 's/ .*//') mv "$BACK/new" "$BACK/rev/$rev" date +"%Y-%m-%d-%H-%M-%S $rev" >> $BACK/log ;; -(set) +(to) more "$BACK/rev/$2" printf 'apply %s? [Y/n] ' "$2" 1>&2 case $(sed q) in (y|Y|'') ;; (*) exit 0 ;; esac @@ -35,8 +35,8 @@ case $1 in less "$BACK/log" ;; (*) - echo 'usage: back new' - echo ' back set <rev>' + echo 'usage: back up' + echo ' back to <rev>' echo ' back log' ;; esac