newt: add 'kf' command to grep $home/lib/newsgroups for group names

This commit is contained in:
stanley lieber 2014-04-11 13:19:18 -04:00
parent 794197adb1
commit 4ae2015d86
2 changed files with 18 additions and 2 deletions

View file

@ -75,7 +75,7 @@ fn k{
kmnt=`{echo $mnt | sed 's/\//\\\//g'} kmnt=`{echo $mnt | sed 's/\//\\\//g'}
f $mnt/$* | f $mnt/$* |
grep -v -e '\/([0-9]+|article|body|header|post|xover)$' | grep -v -e '\/([0-9]+|article|body|header|post|xover)$' |
sed 's/^'$"kmnt'\// g /g' | sed 's/^'$"kmnt'\// g /g' |
sort sort
} }
fn nshift{ shift; echo $* } fn nshift{ shift; echo $* }
@ -88,6 +88,7 @@ g ... go to specified group
h print message headlines h print message headlines
help print this help message help print this help message
k ... list sub-groups under specified group k ... list sub-groups under specified group
kf ... grep $home/lib/newsgroups for regexp
l jump to last message l jump to last message
n next n next
p print message with minimal headers p print message with minimal headers
@ -194,6 +195,9 @@ while(){
k $group k $group
case k' '* case k' '*
k `{nshift $cmd | sed 's/\./\//g'} k `{nshift $cmd | sed 's/\./\//g'}
case kf' '*
grep -e `{nshift $cmd} $home/lib/newsgroups |
sed 's/^/ g /g'
case l case l
post=$posts($#posts) post=$posts($#posts)
printp $post printp $post

View file

@ -85,6 +85,13 @@ available sub-group. When provided with an argument,
it instead walks the directories under the group specified it instead walks the directories under the group specified
by the argument. by the argument.
.TP .TP
.BI kf " regexp
Greps
.B $home/lib/newsgroups
for
.I regexp
and prints commands suitable for changing to each match.
.TP
.B l .B l
Jump to the last message in the group. Jump to the last message in the group.
.TP .TP
@ -118,6 +125,9 @@ with the whole message as standard input.
.TP .TP
\fB"\fP \fB"\fP
Print the current message in quoted form, suitable for reply. Print the current message in quoted form, suitable for reply.
.SH FILES
.B $home/lib/newsgroups
list of newsgroups, one per line
.SH SOURCE .SH SOURCE
.B /rc/bin/newt .B /rc/bin/newt
.SH "SEE ALSO" .SH "SEE ALSO"
@ -126,7 +136,9 @@ Print the current message in quoted form, suitable for reply.
The list of available newsgroups offered by a given server The list of available newsgroups offered by a given server
may be quite large. This complicates walking the list over may be quite large. This complicates walking the list over
a slow Internet connection, and renders searching in real-time a slow Internet connection, and renders searching in real-time
all but infeasible. all but infeasible. Grepping a pre-generated
.B newsgroups
file is a compromise.
.SH HISTORY .SH HISTORY
.I Newt .I Newt
first appeared in 9front (April, 2014). first appeared in 9front (April, 2014).