dot

packages and services management
Log | Files | Refs | README

commit 19c5ec88779e884385c473af4b22808aa2d25f84
parent e359273b4663bf89247028b7fef2809189eab0a2
Author: josuah <mail@josuah.net>
Date:   Wed, 28 Dec 2016 17:00:28 +0000

Added a play script

Diffstat:
A.local/bin/play | 4++++
M.local/bin/version | 33+++++++++++++++++----------------
2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/.local/bin/play b/.local/bin/play @@ -0,0 +1,4 @@ +for path in "$@" +do + find "$path" -type f -name '*.flac' -prin0 +done | xargs -0 mplayer diff --git a/.local/bin/version b/.local/bin/version @@ -60,27 +60,28 @@ new() } -trace() +# +# +# +merge() { - md5="$1" name="$2" + version="$({ + find . -type f -maxdepth 1 + cd "$1" || exit + find . -type f -maxdepth 1 + } | sort -r | uniq -d)" while read -r md5 name + do while read -r m n do h="$(history "$m" "$md5" "$n" "$name" "$history")" case "$h" in ( e ) history=e; continue ;; ( x ) continue ;; + esac done < "$(tac .version/history | grep -xFm 1 "$md5 $name")" done - - # for each fork of the file history (md5 and name) - printf %s "$new" | while read -r flag - do - : - done - - history="$history$new" } @@ -97,7 +98,7 @@ history() case "$h" in ( mn ) h=e ;; ( m ) h=r ;; ( n ) h=m ;; ( '' ) h=x ;; esac case "$history$h" in - ( *[erm]x ) h=d ;; + ( *[rem]x ) h=d ;; ( *[xd] ) h=c ;; esac @@ -107,8 +108,8 @@ history() main() { - TREE1="$(root)" - [ -d "$TREE1" ] && cd "$TREE1" || die "could find root tree" + root="$(root)" + [ "$root" ] && cd "$root" || die "could find root tree" case "$1" in ( n | new ) @@ -116,10 +117,10 @@ main() ;; ( m | merge ) [ $# -ne 2 ] && usage - TREE2="$(cd "$2" && root)" - [ -d "$TREE2" ] || die "could find root tree: $2" + root="$(cd "$2" && root)" + [ -z "$root" ] && die "could find root tree: $2" - merge + merge "$root" ;; ( * ) usage