[Surfraw-devel] Surfraw elvi generator

Ian Beckwith ianb at erislabs.net
Fri Nov 8 20:49:31 GMT 2019


Hi,

On Fri, Nov 08, 2019 at 05:00:52PM +1300, Gabriel Lisaca wrote:
> I've been writing a program to generate surfraw elvi based on a higher-level
> description.

Ooh! Please consider contributing it to surfraw.

> As part of this, I wanted to make the process of generating elvi that follow
> common conventions easy, but I'm not particularly sure what the
> conventions--if any--are.
> 
> So my question is: what are some commonly-used options for elvi and their
> associated semantics?

Apart from the global options handled by every elvi (see surfraw -h)
there is little consistency.

The -lh option to each elvi shows help for the local (elvi-specific options).

The following hideous one-liner, run in /usr/lib/surfraw:

for i in *;do sr $i -lh |sed '1,/^Local options:/d'|perl -ne 'if(/^\s*\|*\s+-([^[=\s]+).*/) { print "-$1\n"; }';done|perl -pe 's/,$//;'"s#[,/]#\n#g;"|sort |uniq -c |sort -n |grep -v '^ *1 '

shows all local options that occur more than once:

2 -arc
2 -arch
2 -cat
2 -dist
2 -fields
2 -format
2 -from
2 -i
2 -lang
2 -language
2 -maintainer
2 -num
2 -p
2 -page
2 -pr
2 -safe
2 -scope
2 -title
3 -author
3 -b
3 -category
3 -country
3 -distro
3 -exact
3 -f
3 -mail
3 -method
3 -ps
3 -to
3 -type
4 -c
4 -m
4 -n
4 -r
4 -sort
4 -t
4 -u
4 -v
5 -a
6 -d
8 -l
10 -results
10 -s
11 -search

But a quick look at usage of (eg) -s shows it is used for widely
different purposes in different elvi.

-results *usually* lets you specify the number of results but in the
 ntrs elvi it is used to select AND vs OR search.

-search is generally used to select what collection to search

-sort seems consistent but only implemented by 4 elvi.

Also, in case you aren't aware, and in case it is useful,
have a look at the opensearch standard and elvi.

https://en.wikipedia.org/wiki/Opensearch

cheers,

Ian.

-- 
Ian Beckwith - ianb at erislabs.net - http://erislabs.net/ianb/
New key: 4096R/A796 3918 B66A A6DD CFC5  EFF2 17D7 13AD 62E8 8618
Listening to: Front Line Assembly - WarMech - Meteorfall



More information about the Surfraw-devel mailing list