dot

packages and services management
Log | Files | Refs | README

commit e359273b4663bf89247028b7fef2809189eab0a2
parent 7ae8a09d39fd8850d0b48b2b82b565292fcc170a
Author: josuah <mail@josuah.net>
Date:   Wed, 28 Dec 2016 15:36:37 +0000

Updated scritps

Diffstat:
M.local/bin/music-rename | 2+-
M.local/bin/version | 72+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
M.profile | 30++++++++++++++----------------
3 files changed, 76 insertions(+), 28 deletions(-)

diff --git a/.local/bin/music-rename b/.local/bin/music-rename @@ -6,7 +6,7 @@ transform() { s|([^[:alnum:]][[:digit:]]+) - |\1--|g s| - |/|g s|&|and|g - y| |-| + s|[^[:alnum:],./-]|-|g ' | tr -d '|[[]{}()<>*$' } diff --git a/.local/bin/version b/.local/bin/version @@ -45,9 +45,10 @@ root() new() { - find . -type f $(exclude .git .version) | xargs md5sum > .version/tmp - md5="$(md5sum .version/tmp | cut -d ' ' -f 1)" + find . -type f $(exclude .git .version) -print0 | sort -z | + xargs -0 md5sum > .version/tmp + md5="$(md5sum .version/tmp | cut -d ' ' -f 1)" if [ "$md5" = "$(tail -n 1 .version/history)" ] then rm .version/tmp @@ -59,22 +60,71 @@ new() } +trace() +{ + md5="$1" name="$2" + + while read -r md5 name + while read -r m n + do + h="$(history "$m" "$md5" "$n" "$name" "$history")" + case "$h" in + ( e ) history=e; continue ;; + ( x ) continue ;; + 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" +} + + +# +# Returns a character describing the change between "$m $n" and "$md5 $name": +# c: creation d: deletion m: modification r: rename x: unexistant e: equal +# +history() +{ + m="$1" md5="$2" n="$3" name="$4" history="$5" h='' + + [ "$m" = "$md5" ] && h="${h}m" + [ "$n" = "$name" ] && h="${h}n" + case "$h" in ( mn ) h=e ;; ( m ) h=r ;; ( n ) h=m ;; ( '' ) h=x ;; esac + + case "$history$h" in + ( *[erm]x ) h=d ;; + ( *[xd] ) h=c ;; + esac + + printf %s "$history" "$h" +} + + main() { + TREE1="$(root)" + [ -d "$TREE1" ] && cd "$TREE1" || die "could find root tree" + case "$1" in - n | new ) - action='new' + ( n | new ) + new + ;; + ( m | merge ) + [ $# -ne 2 ] && usage + TREE2="$(cd "$2" && root)" + [ -d "$TREE2" ] || die "could find root tree: $2" + + merge ;; - * ) + ( * ) usage ;; esac - shift - - TREE1="$(root)" - [ -d "$TREE1" ] && cd "$TREE1" || die "could find root tree" - - $action "$@" } diff --git a/.profile b/.profile @@ -42,22 +42,11 @@ export XDG_RUNTIME_DIR="$HOME/.cache" # prompt export PS1='$( [ $? -eq 0 ] && color=2 || color=1 + [ -z "${PWD##$HOME*}" ] && pwd="~${PWD#$HOME}" || pwd="$PWD" - printf "\a\n" - - # cursor shape it TTY - printf "\033[?6c" - - # current path with "$HOME" replaced with '~' - printf "\033[30;1m" - [ -z "${PWD##$HOME*}" ] && printf ~%s "${PWD#$HOME}" || printf %s "$PWD" - printf "\033[m" - - # git branch and status + printf "\a\n \033[?6c\033[30;1m%s\033[m" "$pwd" git-prompt - - # prompt character - printf "\n\033[1;30m>\033[0;3%sm>\033[1m>\033[m " "$color" + printf "\n \033[1;30m>\033[0;3%sm>\033[1m>\033[m " "$color" )' export PS2=' > ' export PS3=' > ' @@ -205,6 +194,15 @@ screencast() # Startup #_______________________________________________________________________________ -[ "$TERM" = 'linux' ] && setfont ~/.local/share/consolefonts/tamsyn-16n.psf +main() +{ + if [ "$TERM" = 'linux' ] + then + setfont ~/.local/share/consolefonts/tamsyn-16n.psf + fi + + [ "$ABDUCO" ] || TERM='screen' ABDUCO='dvtm' abduco -A dvtm dvtm-status +} + -[ "$ABDUCO" ] || TERM='screen' ABDUCO='dvtm' abduco -A dvtm dvtm-status +main "$@"