stew

a monorepo of some sort
Log | Files | Refs

commit 8307e1c8bb63c8205d548806061acae08352157d
parent 4fa98fecf66bdf2dd7480d5061b55d0105fac6c1
Author: rpa <rpa@grass>
Date:   Wed, 22 Nov 2023 19:29:46 +0000

wdb: clean up scripts

Diffstat:
Msrc/wdb/genindex | 29++---------------------------
Dsrc/wdb/tagsearch | 9---------
Dsrc/wdb/typesearch | 9---------
Msrc/wdb/ui.inc | 14+++++++++-----
4 files changed, 11 insertions(+), 50 deletions(-)

diff --git a/src/wdb/genindex b/src/wdb/genindex @@ -2,33 +2,8 @@ rfork e -fn index1 { - field=$1 - for (file in *) { - echo -n $"file^' ' - sed -n '/ *'$field' \\/p' $file | sed 's/.*\\//' - } -} - -fn indexs { - field=$1 - for (file in *) { - # echo $file - awk ' - BEGIN {pflag = 0} - /^[a-zA-Z]+/ {pflag = 0} - /^'$field'/ {pflag = 1} - /^ \\/ {if (pflag == 1) printf ("%s\t%s\n", "'$file'", substr($0, 3))} - ' $file - - } -} - cd $home/lib/wdb/data -### switching to monodb only -# echo Indexing names...; indexs name > $home/lib/wdb/index/name -# echo Indexing tags...; index1 tags > $home/lib/wdb/index/tags -# echo Indexing types...; index1 type > $home/lib/wdb/index/type -echo generating monodb...; wdb/print > $home/lib/wdb/index/all +echo generating monodb...; +wdb/print > $home/lib/wdb/index/all echo Done. diff --git a/src/wdb/tagsearch b/src/wdb/tagsearch @@ -1,9 +0,0 @@ -#!/bin/rc -# Searches for entries by tag. -# Operates on indexed data. -# returns a list of id's. - -# TODO: should accept multiple tags - -rfork e -grep $"* $home/lib/wdb/index/tags | sed 's/ .*//' | sort | uniq diff --git a/src/wdb/typesearch b/src/wdb/typesearch @@ -1,9 +0,0 @@ -#!/bin/rc -# Searches for entries by type. -# Operates on indexed data. -# returns a list of id's. - -# TODO: should accept multiple tags - -rfork e -grep $"* $home/lib/wdb/index/type | sed 's/ .*//' | sort | uniq diff --git a/src/wdb/ui.inc b/src/wdb/ui.inc @@ -31,6 +31,10 @@ fn entry { cat $data/$id } +fn enumer { + echo Fount $#1 entries. +} + fn main { echo -n '→ ' input=`{read} @@ -43,15 +47,15 @@ fn main { wdb/genindex case s guids=`{wdb/search $"arg} - echo Found $#guids entries. + enumer $guids printguids case t - guids=`{wdb/tagsearch $"arg} - echo Found $#guids entries. + guids=`{wdb/search -t $"arg} + enumer $guids printguids case T - guids=`{wdb/typesearch $"arg} - echo Fount $#guids entries. + guids=`{wdb/search -T $"arg} + enumer $guids printguids case q echo bye