stew

a monorepo of some sort
Log | Files | Refs

commit bb43da6c9c0f11d1b9acd6211c9319ecb6918969
parent 750c673a3f58812925bb6e142712893dc083aa0c
Author: rpa <rpa@laika>
Date:   Sun, 23 Apr 2023 16:34:55 +0000

rc/wdb2tl: a script

Diffstat:
Arc/wdb2tl | 47+++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+), 0 deletions(-)

diff --git a/rc/wdb2tl b/rc/wdb2tl @@ -0,0 +1,47 @@ +#!/bin/rc +# converts wdb entry from dir format to new tablist format + +rfork e + + +wdb=/n/wdb/data +uuid=$1 +dir=$"wdb/$"uuid + +test -d $"dir || { echo 'no such dir' $dir; exit 'bad uuid'} + +fn fail { + if (test '!' -f $1) { + echo 'fail' $1 + exit 'fail' + } +} + +fn wprint1 { + field=$1 + file=$"dir/$"field + fail $"file + echo -n $"field^' \' + read $"file +} + +fn wprints { + field=$1 + file=$"dir/$"field + fail $"file + echo $"field + awk '{printf("\t\\%s\n", $0)}' $"file +} + +fn wtest { + file=$dir/$1 + echo testing $file + fail $file + echo ok $file +} + +wprints name +wprint1 tags +wprint1 type +wprint1 status +test -f $dir/extra && wprints extra