Skip to content

Commit ca54c94

Browse files
committed
Write to 'tags' file if no -f option given
1 parent 74e4e44 commit ca54c94

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

phpctags

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,15 @@ try {
138138
die("phpctags: {$e->getMessage()}");
139139
}
140140

141+
// write to a specified file
141142
if (isset($options['f']) && $options['f'] !== '-') {
142143
$tagfile = fopen($options['f'], isset($options['a']) ? 'a' : 'w');
143-
} else {
144+
// write to stdout only when instructed
145+
} else if (isset($options['f']) && $options['f'] === '-') {
144146
$tagfile = fopen('php://stdout', 'w');
147+
// write to file 'tags' by default
148+
} else {
149+
$tagfile = fopen('tags', isset($options['a']) ? 'a' : 'w');
145150
}
146151
fwrite($tagfile, $result);
147152
fclose($tagfile);

0 commit comments

Comments
 (0)