File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ if (is_dir($vendor = __DIR__ . '/vendor')) {
1313}
1414
1515$ options = getopt ('af: ' ,array (
16+ 'append:: ' ,
1617 'debug ' ,
1718 'excmd:: ' ,
1819 'fields:: ' ,
@@ -47,6 +48,14 @@ if(!isset($options['fields'])) {
4748 $ options ['fields ' ] = str_split ($ options ['fields ' ]);
4849}
4950
51+ if (isset ($ options ['append ' ])) {
52+ if ($ options ['append ' ] === FALSE || yes_or_no ($ options ['append ' ]) == 'yes ' ) {
53+ $ options ['a ' ] = FALSE ;
54+ } else if (yes_or_no ($ options ['append ' ]) != 'no ' ) {
55+ die ('phpctags: Invalid value for "append" option ' );
56+ }
57+ }
58+
5059$ ctags = new PHPCtags ();
5160$ result = $ ctags ->export ($ file , $ options );
5261
@@ -57,3 +66,13 @@ if (isset($options['f']) && $options['f'] !== '-') {
5766}
5867fwrite ($ tagfile , $ result );
5968fclose ($ tagfile );
69+
70+ function yes_or_no ($ arg ) {
71+ if (preg_match ('/\b[Y|y]([E|e][S|s])?\b/ ' , $ arg )) {
72+ return 'yes ' ;
73+ } else if (preg_match ('/\b[N|n]([O|o])?\b/ ' , $ arg )) {
74+ return 'no ' ;
75+ } else {
76+ return false ;
77+ }
78+ }
You can’t perform that action at this time.
0 commit comments