Skip to content

Commit e9e44d3

Browse files
committed
Merge branch 'master' of github.com:rtwo/phpctags into issue/31
2 parents 25adbbb + ecd9701 commit e9e44d3

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

PHPCtags.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ private function render()
256256
foreach ($this->mStructs as $struct) {
257257
$file = $struct['file'];
258258

259+
if (!in_array($struct['kind'], $this->mOptions['kinds'])) {
260+
continue;
261+
}
262+
259263
if (!isset($files[$file]))
260264
$files[$file] = file($file);
261265

bootstrap.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'exclude:',
2525
'excmd::',
2626
'fields::',
27+
'kinds::',
2728
'format::',
2829
'help',
2930
'recurse::',
@@ -57,7 +58,9 @@
5758
--excmd=number|pattern|mix
5859
Uses the specified type of EX command to locate tags [mix].
5960
--fields=[+|-]flags
60-
Include selected extension fields (flags: "afmikKlnsStz") [fks].
61+
Include selected extension fields (flags: "afmikKlnsStz") [fks].
62+
--kinds=[+|-]flags
63+
Enable/disable tag kinds [cmfpvdi]
6164
--format=level
6265
Force output of specified tag file format [2].
6366
--help
@@ -141,12 +144,20 @@
141144
$options['format'] = 2;
142145
if (!isset($options['memory']))
143146
$options['memory'] = '128M';
147+
144148
if (!isset($options['fields'])) {
145149
$options['fields'] = array('n', 'k', 's', 'a','i');
146150
} else {
147151
$options['fields'] = str_split($options['fields']);
148152
}
149153

154+
if (!isset($options['kinds'])) {
155+
$options['kinds'] = array('c', 'm', 'f', 'p', 'd', 'v', 'i');
156+
} else {
157+
$options['kinds'] = str_split($options['kinds']);
158+
}
159+
160+
150161
// handle -u or --sort options
151162
if (isset($options['sort'])) {
152163
// --sort or --sort=[Y,y,YES,Yes,yes]
@@ -218,6 +229,8 @@
218229
}
219230

220231
$mode = ($options['sort'] == 'yes' ? 1 : ($options['sort'] == 'foldcase' ? 2 : 0));
232+
233+
if (!isset($options['a'])) {
221234
$tagline = <<<EOF
222235
!_TAG_FILE_FORMAT\t2\t/extended format; --format=1 will not append ;" to lines/
223236
!_TAG_FILE_SORTED\t{$mode}\t/0=unsorted, 1=sorted, 2=foldcase/
@@ -226,6 +239,7 @@
226239
!_TAG_PROGRAM_URL\thttps://github.com/techlivezheng/phpctags\t/official site/
227240
!_TAG_PROGRAM_VERSION\t${version}\t//\n
228241
EOF;
242+
}
229243

230244
fwrite($tagfile, $tagline.$result);
231245
fclose($tagfile);

0 commit comments

Comments
 (0)