-
Notifications
You must be signed in to change notification settings - Fork 89
AddCommand: use force flag #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey @Slamdunk, thanks for contributing! Not sure how I missed that before 😅 |
src/Commands/AddCommand.php
Outdated
@@ -57,7 +59,10 @@ protected function execute(InputInterface $input, OutputInterface $output) | |||
|
|||
file_put_contents($filename, $script); | |||
chmod($filename, 0755); | |||
$output->writeln("Added <info>{$hook}</info> hook"); | |||
$output->writeln($fileExists | |||
? "<info>{$hook}</info> overridden" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer "Added <info>{$hook}</info> hook forcefully"
. The forceful part can even be emphasized with another color. Probably <fg=red>
or something like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to avoid false positive tests between this and:
composer-git-hooks/tests/AddCommandTest.php
Lines 26 to 33 in e4b55a7
public function it_adds_hooks_that_do_not_already_exist() | |
{ | |
$this->commandTester->execute([]); | |
foreach (array_keys(self::$hooks) as $hook) { | |
$this->assertContains("Added {$hook} hook", $this->commandTester->getDisplay()); | |
} | |
} |
Because the asserted string would be a subpart of the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. Okay, I would still like to maintain the format, so maybe we can use Overwrote instead of Added. I don't like the verb though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the verb though.
LoL, why? :)
@Slamdunk Thanks! |
The
force
flag is unused in the current implementation.