@@ -28,13 +28,15 @@ protected function configure()
2828 ->addOption ('no-lock ' , 'l ' , InputOption::VALUE_NONE , 'Do not create a lock file ' )
2929 ->addOption ('ignore-lock ' , 'i ' , InputOption::VALUE_NONE , 'Add the lock file to .gitignore ' )
3030 ->addOption ('git-dir ' , 'g ' , InputOption::VALUE_REQUIRED , 'Path to git directory ' , '.git ' )
31+ ->addOption ('force-win ' , null , InputOption::VALUE_NONE , 'Force windows bash compatibility ' )
3132 ;
3233 }
3334
3435 protected function execute (InputInterface $ input , OutputInterface $ output )
3536 {
3637 $ addedHooks = [];
3738 $ gitDir = $ input ->getOption ('git-dir ' );
39+ $ forceWindows = $ input ->getOption ('force-win ' );
3840 $ hookDir = "{$ gitDir }/hooks " ;
3941
4042 if (! is_dir ($ hookDir )) {
@@ -47,7 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
4749 if (file_exists ($ filename )) {
4850 $ output ->writeln ("<comment> {$ hook } already exists</comment> " );
4951 } else {
50- if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
52+ if ($ forceWindows || strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
5153 // On windows we need to add a SHEBANG
5254 // See: https://github.com/BrainMaestro/composer-git-hooks/issues/7
5355 $ script = '#!/bin/bash ' . PHP_EOL . $ script ;
0 commit comments