1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/packages/ubuntu-gutsy/python-astgrep/debian/astgrep.1 Mon Oct 27 00:21:56 2008 +0100
1.3 @@ -0,0 +1,87 @@
1.4 +.TH "ASTGREP" "1"
1.5 +
1.6 +.\" Manual page prepared by:
1.7 +.\"
1.8 +.\" Paul Boddie <paul@boddie.org.uk>
1.9 +.\"
1.10 +.\" To view this file while editing, run it through groff:
1.11 +.\" groff -Tascii -man astgrep.1 | less
1.12 +
1.13 +.SH NAME
1.14 +astgrep \- grep/search through Python abstract syntax trees
1.15 +.SH SYNOPSIS
1.16 +.B astgrep
1.17 +[options] \-t TERM_TYPE [ \-e PATTERN ] ( \-r DIRECTORY | FILE )
1.18 +.SH DESCRIPTION
1.19 +\fBastgrep\fR is a program which searches through Python source files for
1.20 +textual information of a specific type. Instead of matching a search term or
1.21 +expression, \fIPATTERN\fR, to all text in a program, as \fBgrep\fR would do,
1.22 +\fBastgrep\fR matches only tokens in the program having a particular type,
1.23 +specified using \fITERM_TYPE\fR, such as names or constants.
1.24 +
1.25 +Like \fBgrep\fR, a single \fIFILE\fR or a number of files within a directory
1.26 +hierarchy, \fIDIRECTORY\fR, can be searched, with the occurrences listed from
1.27 +each file.
1.28 +.SH COMMAND LINE OPTIONS
1.29 +.TP
1.30 +.BR \-n , " \-\-line-number"
1.31 +Show the line number of each match.
1.32 +.TP
1.33 +.BR \-p , " \-\-print-token"
1.34 +Show the matching token for each match.
1.35 +.TP
1.36 +\fB\-t\fR, \fB\-\-type\fR=\fITERM_TYPE\fR
1.37 +Indicate the type of token to be matched.
1.38 +.TP
1.39 +\fB\-e\fR, \fB\-\-regexp\fR=\fIPATTERN\fR
1.40 +Use \fIPATTERN\fR as the term to search for.
1.41 +.TP
1.42 +\fB\-r\fR, \fB\-R\fR, \fB\-\-recursive\fR \fIDIRECTORY\fR
1.43 +Search Python files within \fIDIRECTORY\fR, recursively.
1.44 +.SH TERM TYPES
1.45 +Details of term types can be found in the "AST Nodes" section of the Python
1.46 +Library Reference or by using \fBpydoc\fR to inspect the node classes in the
1.47 +\fBcompiler.ast\fR Python module:
1.48 +.RS 4
1.49 +.PP
1.50 +.PD 0
1.51 +.B pydoc compiler.ast
1.52 +.RE
1.53 +.PD
1.54 +.SH EXAMPLES
1.55 +Search for classes whose name contains \fINode\fR in a particular file:
1.56 +.RS 4
1.57 +.PP
1.58 +.PD 0
1.59 +.B astgrep -t Class -e Node libxml2dom/__init__.py
1.60 +.RE
1.61 +.PD
1.62 +.PP
1.63 +Search for functions or methods whose name starts with \fIvisit\fR in a
1.64 +particular directory hierarchy, \fImicropython\fR, showing the name of the
1.65 +matching functions in the output:
1.66 +.RS 4
1.67 +.PP
1.68 +.PD 0
1.69 +.B astgrep -p -t Function -e '^visit' -r micropython
1.70 +.RE
1.71 +.PD
1.72 +.PP
1.73 +Search for accesses of attributes having the exact name \fI_node\fR in a
1.74 +particular directory hierarchy, \fIlibxml2dom\fR, showing the line number of
1.75 +each match in the output:
1.76 +.RS 4
1.77 +.PP
1.78 +.PD 0
1.79 +.B astgrep -n -t Getattr -e '^_node$' -r libxml2dom
1.80 +.RE
1.81 +.PD
1.82 +.SH SEE ALSO
1.83 +.BR python (1),
1.84 +.BR grep (1)
1.85 +.PP
1.86 +astgrep
1.87 +.I http://www.boddie.org.uk/python/astgrep.html
1.88 +.PD
1.89 +.SH COPYRIGHT
1.90 +Copyright \(co 2008 Paul Boddie; License GNU GPL version 3