[PEAK] glimpse: another tool for exploring the PEAK

Stephen Waterbury golux at comcast.net
Fri Apr 9 18:43:51 EDT 2004


Being a longtime fan of glimpse (http://webglimpse.net/download.php),
I like to use it for exploring big codebases like Twisted and PEAK.
Glimpse is sort of like grep on steroids:  you can index a whole
directory using glimpseindex, telling it which files to include
or exclude (.glimpse_[include|exclude]), and then search them using
all the features of agrep (see attached list of switches).

To set this up:

(1) download glimpse from the link above, compile and install it.  

(2) save the attached glimpsepeak.tar.gz file into your PEAK directory,

    tar zxvf glimpsepeak.tar.gz

    (This creates a glimpse index of all .py files below the src directory.
    Note that all the index files are hidden files, .glimpse_blah, in the
    glimpseindexes directory.)

(3) create an alias similar to this:

    alias glimpsepeak='glimpse -H [path to PEAK]/PEAK/glimpse/glimpseindexes'

Now, from anywhere you happen to be, you can use the following command
to see where a string occurs in PEAK's src files:

    glimpsepeak [string]

... which can take any of the agrep switches (see agrep_usage, attached),
which probably includes all your favorites plus some extras, such as

    -#: find matches with at most # errors
    -B: best match mode. find the closest matches to the pattern

... and more.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: glimpsepeak.tar.gz
Type: application/x-tar
Size: 537 bytes
Desc: not available
Url : http://www.eby-sarna.com/pipermail/peak/attachments/20040409/1216d9da/glimpsepeak.tar.tar
-------------- next part --------------
usage: agrep [-@#abcdehiklnoprstvwxyBDGIMSV] [-f patternfile] [-H
dir] pattern [files]

summary of frequently used options:
(For a more detailed listing see 'man agrep'.)
-#: find matches with at most # errors
-c: output the number of matched records
-d: define record delimiter
-h: do not output file names
-i: case-insensitive search, e.g., 'a' = 'A'
-l: output the names of files that contain a match
-n: output record prefixed by record number
-v: output those records that have no matches
-w: pattern has to match as a word, e.g., 'win' will not match
-B: best match mode. find the closest matches to the pattern
-G: output the files that contain a match
-H 'dir': the cast-dictionary is located in directory 'dir'

More information about the PEAK mailing list