Skip to content

Commit 825c20d

Browse files
committed
fixed minor bug in markdown output
1 parent 0f24bb7 commit 825c20d

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/Commands/ReportProject.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
7777
// Get params (for filtering via milestone/label/closed)
7878
$params = $this->getParams($closed, $milestone);
7979

80+
// Choose output
81+
if ( ! $outputOption) {
82+
$outputInstance = new Table($input, $output, $questionHelper, $columns, $file);
83+
} elseif (array_key_exists($outputOption, $this->outputs)) {
84+
$outputClassName = $this->outputs[$outputOption];
85+
$outputInstance = new $outputClassName($input, $output, $questionHelper, $columns, $file);
86+
} else {
87+
throw new \Exception("Output '{$output}' not found!");
88+
}
89+
8090
// Get issues
8191
$issues = $this->getIssues($output, $project, $params, $includeLabels, $excludeLabels);
8292
$issues = $this->filterIssuesByArgument($issues, $input);
@@ -88,16 +98,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
8898
// Set time records in issues
8999
$issues = $this->setTimesInIssues($output, $issues, $from, $to, $user);
90100

91-
// Choose output
92-
if ( ! $outputOption) {
93-
$outputInstance = new Table($input, $output, $questionHelper, $columns, $file);
94-
} elseif (array_key_exists($outputOption, $this->outputs)) {
95-
$outputClassName = $this->outputs[$outputOption];
96-
$outputInstance = new $outputClassName($input, $output, $questionHelper, $columns, $file);
97-
} else {
98-
throw new \Exception("Output '{$output}' not found!");
99-
}
100-
101101
// Put everything out there!
102102
$outputInstance->render($issues, $this->config);
103103

src/Output/AbstractOutput.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ protected function write($contents, $file)
108108
throw new \Exception('You have to specify a file path using the --file option!');
109109
}
110110

111-
if ( ! file_exists($file)) {
111+
if (file_exists($file)) {
112112
$question = new ConfirmationQuestion(
113-
"File '{$file}' doesn't exist. Should it be created?",
113+
"File '{$file}' exist. Overwrite it?",
114114
true,
115115
'/^(y|j)/i'
116116
);
@@ -119,13 +119,14 @@ protected function write($contents, $file)
119119
throw new \Exception("Could not write file '{$file}'");
120120
}
121121

122-
if ( ! file_exists(dirname($file))) {
123-
mkdir(dirname($file), 0755, true);
124-
}
122+
unlink($file);
123+
}
125124

126-
touch($file);
125+
if ( ! file_exists(dirname($file))) {
126+
mkdir(dirname($file), 0755, true);
127127
}
128128

129+
touch($file);
129130
file_put_contents($file, $contents);
130131
}
131132
}

0 commit comments

Comments
 (0)