Skip to content

Commit 9c620c6

Browse files
committed
Make command output consistent across all commands
1 parent 34186f5 commit 9c620c6

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

src/Commands/ChangelogCurrentCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public function handle(FeatureAdapter $adapter, GitDriver $gitState)
3838

3939
return;
4040
}
41+
4142
$feature = $adapter->read($path);
4243
$this->line("Changes for $branch:");
4344

src/Commands/ChangelogGenerateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function handle(ReleaseAdapter $adapter, ChangelogFormatterFactory $facto
4949
}
5050

5151
file_put_contents($writePath, $content);
52-
$this->info('The changelog is written to: '.$writePath);
52+
$this->info("The changelog is written to: $writePath");
5353
}
5454

5555
/**

src/Commands/ChangelogListCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ public function handle(ReleaseAdapter $adapter, ChangelogFormatterFactory $facto
3636

3737
$releases = $this->releases($adapter, $path);
3838

39-
$formatted = $formatter->multiple($releases);
39+
$lines = explode(PHP_EOL, $formatter->multiple($releases));
4040

41-
$this->line($formatted);
41+
foreach($lines as $line) {
42+
$this->line($line);
43+
}
4244
}
4345

4446
/**

src/Commands/ChangelogUnreleasedCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ public function handle(ReleaseAdapter $adapter, ChangelogFormatterFactory $facto
3636

3737
$release = $this->release($adapter, $path);
3838

39-
$formatted = $formatter->single($release);
40-
$this->line($formatted);
39+
$lines = explode(PHP_EOL, $formatter->single($release));
40+
41+
foreach($lines as $line) {
42+
$this->line($line);
43+
}
4144
}
4245

4346
/**

tests/Commands/ChangelogListCommandTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public function it_can_list_all_changes_for_all_releases()
4646
$this->fakeAdapter();
4747

4848
$this->artisan('changelog:list')
49-
->expectsOutput('Unreleased'
50-
.PHP_EOL.' - Added: Added a new feature.'
51-
.PHP_EOL.'V1.0.1'
52-
.PHP_EOL.' - Added: Added a third feature.'
53-
.PHP_EOL.' - Added: Added helper commands.'
54-
.PHP_EOL.' - Removed: Removed unused trait.');
49+
->expectsOutput('Unreleased')
50+
->expectsOutput(' - Added: Added a new feature.')
51+
->expectsOutput('V1.0.1')
52+
->expectsOutput(' - Added: Added a third feature.')
53+
->expectsOutput(' - Added: Added helper commands.')
54+
->expectsOutput(' - Removed: Removed unused trait.');
5555
}
5656
}

tests/Commands/ChangelogUnreleasedCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public function it_can_list_all_unreleased_changes()
4646
$this->fakeAdapter();
4747

4848
$this->artisan('changelog:unreleased')
49-
->expectsOutput('Unreleased'
50-
.PHP_EOL.' - Added: Added a new feature.'
51-
.PHP_EOL.' - Removed: Removed unused trait.');
49+
->expectsOutput('Unreleased')
50+
->expectsOutput(' - Added: Added a new feature.')
51+
->expectsOutput(' - Removed: Removed unused trait.');
5252
}
5353
}

0 commit comments

Comments
 (0)