aboutsummaryrefslogtreecommitdiffstats
path: root/cgrep.roff
blob: 8c48bee24a6661dccee78b6aa8a58f5484acfd3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.TH CGREP "29 Feb 2020"
.SH Farzad Sadeghi
cgrep \ - grep for C-family source files


.SH NAME
.PP
cgrep

.SH SYNOPSIS
.PP
cgrep [options] [target]

.SH DESCRIPTION
.PP
\fBCgrep\fP [ OPTION ] [ TARGET ]
\fIcgrep\fP cgrep is a grep-like tool for the 
C-family languages. It supports a subset of grep
options to search through C-famlily source files.
cgrep is written using clang's libtooling and as such 
will accept any option clang accepts as well. Like clang,
cgrep will require you to have a compilation database. 
.PP
If you can build your sources without any specific command-line 
options, you can pass "--" as the last command-line option which
tells clang to try to build the source without a compilation database.
If you are using \fBmake\fP to build your code-base, you can use \fBBEAR(1)\fP
to generate a compilation database.

.SS Options
.PP
.TP
\fB-A=<int>\fP
same as grep, how many lines after the matched line to print

.TP
\fB-B=<int>\fP
same as grep, howm many lines before the matched line to print

.TP
\fB--all\fP
turns on all switches other than nameddecl

.TP
\fB--awk\fP
outputs location in a gawk freidnly format

.TP
\fB--call\fP
match function calls only

.TP
\fB--class\fP
match class declrations only

.TP
\fB--cxxcall\fP
match member function calls only

.TP
\fB--declrefexpr\fP
matches declrefexpr

.TP
\fB--dir=<string>\fP
recursively goes through all the files and directories. assumes compilation databases are present for all source files.

.TP
\fB--extra-arg=<string>\fP
Additional argument to append to the compiler command line

.TP
\fB--extra-arg-before=<string>\fP
Additional argument to prepend to the compiler command line

.TP
\fB--func\fP
match functions only

.TP
\fB--header\fP
match headers in header inclusions

.TP
\fB--macro\fP
match macro definitions

.TP
\fB--mainfile\fP
match identifiers in the main file only

.TP
\fB--memfunc\fP
match member functions only

.TP
\fB--memvar\fP
match member variables only

.TP
\fB--nameddecl\fP
matches all named declrations

.TP
\fB-p=<string>\fP
Build path

.TP
\fB--regex=<string>\fP
the regex to match against

.TP
\fB--struct\fP
match structures only

.TP
\fB--syshdr\fP
match identifiers in system header as well

.TP
\fB--union\fP
match unions only

.TP
\fB--var\fP
match variables only

.SH "FILES"
.PP
\fBcgrep\fP
The cgrep executable.

.SH "SEE ALSO"
.PP
BEAR(1)

.SH "COPYRIGHT"
.PP
Copyright (C) by Farzad Sadeghi
<https://github.com/bloodstalker/cgrep>

.SH "AUTHORS"
Farzad Sadeghi