Skip to content

Commit d2fb914

Browse files
committed
Add support for more ctags options
1 parent 49b9f3d commit d2fb914

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

phpctags

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (file_exists($autoload = __DIR__ . '/vendor/autoload.php')) {
1212
);
1313
}
1414

15-
$options = getopt('af:R',array(
15+
$options = getopt('af:Nno:RV',array(
1616
'append::',
1717
'debug',
1818
'exclude:',
@@ -24,6 +24,11 @@ $options = getopt('af:R',array(
2424
'memory::',
2525
));
2626

27+
// option -V is an alternative to --version
28+
if (isset($options['V'])) {
29+
$options['version'] = FALSE;
30+
}
31+
2732
if(!isset($options['debug'])) {
2833
error_reporting(0);
2934
}
@@ -43,6 +48,30 @@ array_shift($argv);
4348

4449
$file = array_pop($argv);
4550

51+
// option -o is an alternative to -f
52+
if (isset($options['o']) && !isset($options['f'])) {
53+
$options['f'] = $options['o'];
54+
}
55+
56+
// if both -n and -N options are given, use the last specified one
57+
if (isset($options['n']) && isset($options['N'])) {
58+
if (array_search('n', array_keys($options)) < array_search('N', array_keys($options))) {
59+
unset($options['n']);
60+
} else {
61+
unset($options['N']);
62+
}
63+
}
64+
65+
// option -n is equivalent to --excmd=number
66+
if (isset($options['n']) && !isset($options['N'])) {
67+
$options['excmd'] = 'number';
68+
}
69+
70+
// option -N is equivalent to --excmd=pattern
71+
if (isset($options['N']) && !isset($options['n'])) {
72+
$options['excmd'] = 'pattern';
73+
}
74+
4675
if(!isset($options['excmd']))
4776
$options['excmd'] = 'pattern';
4877
if(!isset($options['format']))

0 commit comments

Comments
 (0)