fileset

git mirror of https://ccx.te2000.cz/bzr/fileset
git clone https://ccx.te2000.cz/git/fileset
Log | Files | Refs | README

commit 566ea063be9e69cc8d89e6af72ad4f56e7011fec
parent 86b27192e3d75152b943e08ccea61b71b9472546
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date:   Thu, 26 Jun 2014 16:20:39 +0200

fix vimdiff, clean $RSFILTER if it exists, more configurable fslist
Diffstat:
Mbin/fileset.awk | 5+++++
Mbin/fslist | 35+++++++++++++++++++++--------------
Mbin/fsvimdiff | 10+++++-----
3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/bin/fileset.awk b/bin/fileset.awk @@ -3,6 +3,11 @@ BEGIN { fname="\"$fname\"" # constants so I don't have to write it out # dirname="\"$dirname\"" or_die="|| exit $?" + + if ("RSFILTER" in ENVIRON) { + # clean the filter file + printf "" >ENVIRON["RSFILTER"] + } } function escaped(str) { diff --git a/bin/fslist b/bin/fslist @@ -36,6 +36,9 @@ statement_end() { ROOT=${${${ROOT:-$PWD}:a}%/} : ${compact:=1} +: ${print_m:=1} +: ${print_o:=1} +: ${print_c:=1} fnames=( ) for arg in "${@:-$ROOT}"; do @@ -81,27 +84,31 @@ for fname in $fnames; do elif [[ $t == l ]]; then statement $'l\t'$s[link] $'\t' elif [[ $t == f ]]; then - IFS= read -r -d '' content <$fname - flags='' - if [[ $content == *$'\n' ]]; then - content=${content%$'\n'} + if (($print_c)); then + IFS= read -r -d '' content <$fname + flags='' if [[ $content == *$'\n' ]]; then - # force appending newline - flags+=n + content=${content%$'\n'} + if [[ $content == *$'\n' ]]; then + # force appending newline + flags+=n + fi + else + flags+=N + fi + if ! (($compact)) || [[ $content == *$'\t'* || $content == *$'\n'* ]]; then + statement C$flags$'\t'$content $'\n' + else + statement c$flags$'\t'$content fi else - flags+=N - fi - if ! (($compact)) || [[ $content == *$'\t'* || $content == *$'\n'* ]]; then - statement C$flags$'\t'$content $'\n' - else - statement c$flags$'\t'$content + statement f fi else statement $t fi - statement o$s[uid]:$s[gid] - statement m$fmode + (($print_o)) && statement o$s[uid]:$s[gid] + (($print_m)) && statement m$fmode statement_end done diff --git a/bin/fsvimdiff b/bin/fsvimdiff @@ -6,10 +6,10 @@ ROOT2="$2" opts='diff scrollbind cursorbind scrollopt+=hor nowrap fdm=diff readonly nomodified buftype=nofile bufhidden=delete' exec vim \ +'0r!ROOT="$ROOT1" fslist' \ - +setlocal\ $opts \ - +"exe 'file '.\$ROOT1.'.fileset'" \ + +"setlocal $opts" \ + +"exe 'file '.\$ROOT1.'.fs'" \ +'rightb vnew' \ +'0r!ROOT="$ROOT2" fslist' \ - +setlocal\ $opts \ - +"exe 'file '.\$ROOT2.'.fileset'" \ - +norm\ ggzM + +"setlocal $opts" \ + +"exe 'file '.\$ROOT2.'.fs'" \ + +'norm ggzM'