@@ -47,9 +47,9 @@ |
||
| 47 | 47 | { |
| 48 | 48 | parent::configure(); |
| 49 | 49 | $this->setName('hook:' . $this->hookName) |
| 50 | - ->setAliases([$this->hookName]) |
|
| 51 | - ->setDescription('Run git ' . $this->hookName . ' hook') |
|
| 52 | - ->setHelp('This command executes the ' . $this->hookName . ' hook'); |
|
| 50 | + ->setAliases([$this->hookName]) |
|
| 51 | + ->setDescription('Run git ' . $this->hookName . ' hook') |
|
| 52 | + ->setHelp('This command executes the ' . $this->hookName . ' hook'); |
|
| 53 | 53 | |
| 54 | 54 | $this->addOption( |
| 55 | 55 | 'bootstrap', |
@@ -41,64 +41,64 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | parent::configure(); |
| 43 | 43 | $this->setName('install') |
| 44 | - ->setDescription('Install hooks to your .git/hooks directory') |
|
| 45 | - ->setHelp('Install git hooks to your .git/hooks directory') |
|
| 46 | - ->addArgument( |
|
| 47 | - 'hook', |
|
| 48 | - InputArgument::OPTIONAL, |
|
| 49 | - 'Limit the hooks you want to install. ' . |
|
| 50 | - 'You can specify multiple hooks with comma as delimiter. ' . |
|
| 51 | - 'By default all hooks get installed' |
|
| 52 | - ) |
|
| 53 | - ->addOption( |
|
| 54 | - 'only-enabled', |
|
| 55 | - null, |
|
| 56 | - InputOption::VALUE_NONE, |
|
| 57 | - 'Limit the hooks you want to install to those enabled in your conf. ' . |
|
| 58 | - 'By default all hooks get installed' |
|
| 59 | - ) |
|
| 60 | - ->addOption( |
|
| 61 | - 'force', |
|
| 62 | - 'f', |
|
| 63 | - InputOption::VALUE_NONE, |
|
| 64 | - 'Force install without confirmation' |
|
| 65 | - ) |
|
| 66 | - ->addOption( |
|
| 67 | - 'skip-existing', |
|
| 68 | - 's', |
|
| 69 | - InputOption::VALUE_NONE, |
|
| 70 | - 'Do not overwrite existing hooks' |
|
| 71 | - ) |
|
| 72 | - ->addOption( |
|
| 73 | - 'move-existing-to', |
|
| 74 | - null, |
|
| 75 | - InputOption::VALUE_OPTIONAL, |
|
| 76 | - 'Move existing hooks to given directory' |
|
| 77 | - ) |
|
| 78 | - ->addOption( |
|
| 79 | - 'bootstrap', |
|
| 80 | - 'b', |
|
| 81 | - InputOption::VALUE_OPTIONAL, |
|
| 82 | - 'Path to composers vendor/autoload.php' |
|
| 83 | - ) |
|
| 84 | - ->addOption( |
|
| 85 | - 'run-mode', |
|
| 86 | - 'm', |
|
| 87 | - InputOption::VALUE_OPTIONAL, |
|
| 88 | - 'Git hook run mode [php|shell|docker]' |
|
| 89 | - ) |
|
| 90 | - ->addOption( |
|
| 91 | - 'run-exec', |
|
| 92 | - 'e', |
|
| 93 | - InputOption::VALUE_OPTIONAL, |
|
| 94 | - 'The Docker command to start your container e.g. \'docker exec CONTAINER\'' |
|
| 95 | - ) |
|
| 96 | - ->addOption( |
|
| 97 | - 'run-path', |
|
| 98 | - 'p', |
|
| 99 | - InputOption::VALUE_OPTIONAL, |
|
| 100 | - 'The path to the CaptainHook executable \'/usr/bin/captainhook\'' |
|
| 101 | - ); |
|
| 44 | + ->setDescription('Install hooks to your .git/hooks directory') |
|
| 45 | + ->setHelp('Install git hooks to your .git/hooks directory') |
|
| 46 | + ->addArgument( |
|
| 47 | + 'hook', |
|
| 48 | + InputArgument::OPTIONAL, |
|
| 49 | + 'Limit the hooks you want to install. ' . |
|
| 50 | + 'You can specify multiple hooks with comma as delimiter. ' . |
|
| 51 | + 'By default all hooks get installed' |
|
| 52 | + ) |
|
| 53 | + ->addOption( |
|
| 54 | + 'only-enabled', |
|
| 55 | + null, |
|
| 56 | + InputOption::VALUE_NONE, |
|
| 57 | + 'Limit the hooks you want to install to those enabled in your conf. ' . |
|
| 58 | + 'By default all hooks get installed' |
|
| 59 | + ) |
|
| 60 | + ->addOption( |
|
| 61 | + 'force', |
|
| 62 | + 'f', |
|
| 63 | + InputOption::VALUE_NONE, |
|
| 64 | + 'Force install without confirmation' |
|
| 65 | + ) |
|
| 66 | + ->addOption( |
|
| 67 | + 'skip-existing', |
|
| 68 | + 's', |
|
| 69 | + InputOption::VALUE_NONE, |
|
| 70 | + 'Do not overwrite existing hooks' |
|
| 71 | + ) |
|
| 72 | + ->addOption( |
|
| 73 | + 'move-existing-to', |
|
| 74 | + null, |
|
| 75 | + InputOption::VALUE_OPTIONAL, |
|
| 76 | + 'Move existing hooks to given directory' |
|
| 77 | + ) |
|
| 78 | + ->addOption( |
|
| 79 | + 'bootstrap', |
|
| 80 | + 'b', |
|
| 81 | + InputOption::VALUE_OPTIONAL, |
|
| 82 | + 'Path to composers vendor/autoload.php' |
|
| 83 | + ) |
|
| 84 | + ->addOption( |
|
| 85 | + 'run-mode', |
|
| 86 | + 'm', |
|
| 87 | + InputOption::VALUE_OPTIONAL, |
|
| 88 | + 'Git hook run mode [php|shell|docker]' |
|
| 89 | + ) |
|
| 90 | + ->addOption( |
|
| 91 | + 'run-exec', |
|
| 92 | + 'e', |
|
| 93 | + InputOption::VALUE_OPTIONAL, |
|
| 94 | + 'The Docker command to start your container e.g. \'docker exec CONTAINER\'' |
|
| 95 | + ) |
|
| 96 | + ->addOption( |
|
| 97 | + 'run-path', |
|
| 98 | + 'p', |
|
| 99 | + InputOption::VALUE_OPTIONAL, |
|
| 100 | + 'The path to the CaptainHook executable \'/usr/bin/captainhook\'' |
|
| 101 | + ); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | $template = Template\Builder::build($config, $repo, $this->resolver); |
| 131 | 131 | $installer = new Installer($io, $config, $repo, $template); |
| 132 | 132 | $installer->setForce(IOUtil::argToBool($input->getOption('force'))) |
| 133 | - ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing'))) |
|
| 134 | - ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to'))) |
|
| 135 | - ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled'))) |
|
| 136 | - ->setHook(IOUtil::argToString($input->getArgument('hook'))) |
|
| 137 | - ->run(); |
|
| 133 | + ->setSkipExisting(IOUtil::argToBool($input->getOption('skip-existing'))) |
|
| 134 | + ->setMoveExistingTo(IOUtil::argToString($input->getOption('move-existing-to'))) |
|
| 135 | + ->setOnlyEnabled(IOUtil::argToBool($input->getOption('only-enabled'))) |
|
| 136 | + ->setHook(IOUtil::argToString($input->getArgument('hook'))) |
|
| 137 | + ->run(); |
|
| 138 | 138 | |
| 139 | 139 | return 0; |
| 140 | 140 | } |
@@ -37,19 +37,19 @@ |
||
| 37 | 37 | { |
| 38 | 38 | parent::configure(); |
| 39 | 39 | $this->setName('uninstall') |
| 40 | - ->setDescription('Remove all git hooks from your .git/hooks directory') |
|
| 41 | - ->setHelp('Remove all git hooks from your .git/hooks directory') |
|
| 42 | - ->addArgument( |
|
| 43 | - 'hook', |
|
| 44 | - InputArgument::OPTIONAL, |
|
| 45 | - 'Remove only this one hook. By default all hooks get uninstalled' |
|
| 46 | - ) |
|
| 47 | - ->addOption( |
|
| 48 | - 'move-existing-to', |
|
| 49 | - null, |
|
| 50 | - InputOption::VALUE_OPTIONAL, |
|
| 51 | - 'Move existing hooks to this directory' |
|
| 52 | - ); |
|
| 40 | + ->setDescription('Remove all git hooks from your .git/hooks directory') |
|
| 41 | + ->setHelp('Remove all git hooks from your .git/hooks directory') |
|
| 42 | + ->addArgument( |
|
| 43 | + 'hook', |
|
| 44 | + InputArgument::OPTIONAL, |
|
| 45 | + 'Remove only this one hook. By default all hooks get uninstalled' |
|
| 46 | + ) |
|
| 47 | + ->addOption( |
|
| 48 | + 'move-existing-to', |
|
| 49 | + null, |
|
| 50 | + InputOption::VALUE_OPTIONAL, |
|
| 51 | + 'Move existing hooks to this directory' |
|
| 52 | + ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | parent::configure(); |
| 38 | 38 | $this->setName('config:disable') |
| 39 | - ->setAliases(['disable']) |
|
| 40 | - ->setDescription('Disable the handling for a hook in your configuration') |
|
| 41 | - ->setHelp('Disable the handling for a hook in your configuration') |
|
| 42 | - ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to disable'); |
|
| 39 | + ->setAliases(['disable']) |
|
| 40 | + ->setDescription('Disable the handling for a hook in your configuration') |
|
| 41 | + ->setHelp('Disable the handling for a hook in your configuration') |
|
| 42 | + ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to disable'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $editor = new Editor($io, $config); |
| 60 | 60 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 61 | - ->setChange('DisableHook') |
|
| 62 | - ->run(); |
|
| 61 | + ->setChange('DisableHook') |
|
| 62 | + ->run(); |
|
| 63 | 63 | |
| 64 | 64 | return 0; |
| 65 | 65 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | parent::configure(); |
| 38 | 38 | $this->setName('config:add') |
| 39 | - ->setAliases(['add']) |
|
| 40 | - ->setDescription('Add an action to your hook configuration') |
|
| 41 | - ->setHelp('Add an action to your hook configuration') |
|
| 42 | - ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to add the action to'); |
|
| 39 | + ->setAliases(['add']) |
|
| 40 | + ->setDescription('Add an action to your hook configuration') |
|
| 41 | + ->setHelp('Add an action to your hook configuration') |
|
| 42 | + ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to add the action to'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $editor = new Editor($io, $config); |
| 60 | 60 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 61 | - ->setChange('AddAction') |
|
| 62 | - ->run(); |
|
| 61 | + ->setChange('AddAction') |
|
| 62 | + ->run(); |
|
| 63 | 63 | |
| 64 | 64 | return 0; |
| 65 | 65 | } |
@@ -36,10 +36,10 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | parent::configure(); |
| 38 | 38 | $this->setName('config:enable') |
| 39 | - ->setAliases(['enable']) |
|
| 40 | - ->setDescription('Enable the handling for a hook in your configuration') |
|
| 41 | - ->setHelp('Enable the handling for a hook in your configuration') |
|
| 42 | - ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to enable'); |
|
| 39 | + ->setAliases(['enable']) |
|
| 40 | + ->setDescription('Enable the handling for a hook in your configuration') |
|
| 41 | + ->setHelp('Enable the handling for a hook in your configuration') |
|
| 42 | + ->addArgument('hook', InputArgument::REQUIRED, 'Hook you want to enable'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $editor = new Editor($io, $config); |
| 60 | 60 | $editor->setHook(IOUtil::argToString($input->getArgument('hook'))) |
| 61 | - ->setChange('EnableHook') |
|
| 62 | - ->run(); |
|
| 61 | + ->setChange('EnableHook') |
|
| 62 | + ->run(); |
|
| 63 | 63 | |
| 64 | 64 | return 0; |
| 65 | 65 | } |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | parent::configure(); |
| 39 | 39 | $this->setName('configure') |
| 40 | - ->setDescription('Create or update a captainhook.json configuration') |
|
| 41 | - ->setHelp('Create or update a captainhook.json configuration') |
|
| 42 | - ->addOption('extend', 'e', InputOption::VALUE_NONE, 'Extend existing configuration file') |
|
| 43 | - ->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite existing configuration file') |
|
| 44 | - ->addOption('advanced', 'a', InputOption::VALUE_NONE, 'More options, but more to type') |
|
| 45 | - ->addOption( |
|
| 46 | - 'bootstrap', |
|
| 47 | - null, |
|
| 48 | - InputOption::VALUE_OPTIONAL, |
|
| 49 | - 'Path to composers vendor/autoload.php' |
|
| 50 | - ); |
|
| 40 | + ->setDescription('Create or update a captainhook.json configuration') |
|
| 41 | + ->setHelp('Create or update a captainhook.json configuration') |
|
| 42 | + ->addOption('extend', 'e', InputOption::VALUE_NONE, 'Extend existing configuration file') |
|
| 43 | + ->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite existing configuration file') |
|
| 44 | + ->addOption('advanced', 'a', InputOption::VALUE_NONE, 'More options, but more to type') |
|
| 45 | + ->addOption( |
|
| 46 | + 'bootstrap', |
|
| 47 | + null, |
|
| 48 | + InputOption::VALUE_OPTIONAL, |
|
| 49 | + 'Path to composers vendor/autoload.php' |
|
| 50 | + ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $configurator = new Creator($io, $config); |
| 67 | 67 | $configurator->force(IOUtil::argToBool($input->getOption('force'))) |
| 68 | - ->extend(IOUtil::argToBool($input->getOption('extend'))) |
|
| 69 | - ->advanced(IOUtil::argToBool($input->getOption('advanced'))) |
|
| 70 | - ->setExecutable($this->resolver->getExecutable()) |
|
| 71 | - ->run(); |
|
| 68 | + ->extend(IOUtil::argToBool($input->getOption('extend'))) |
|
| 69 | + ->advanced(IOUtil::argToBool($input->getOption('advanced'))) |
|
| 70 | + ->setExecutable($this->resolver->getExecutable()) |
|
| 71 | + ->run(); |
|
| 72 | 72 | return 0; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -42,14 +42,14 @@ |
||
| 42 | 42 | foreach (Git\Range\Detector::getRanges($this->io) as $range) { |
| 43 | 43 | $filesInDiff = isset($options['of-type']) |
| 44 | 44 | ? $this->repository->getDiffOperator()->getChangedFilesOfType( |
| 45 | - $range->from()->id(), |
|
| 46 | - $range->to()->id(), |
|
| 47 | - $options['of-type'] |
|
| 48 | - ) |
|
| 45 | + $range->from()->id(), |
|
| 46 | + $range->to()->id(), |
|
| 47 | + $options['of-type'] |
|
| 48 | + ) |
|
| 49 | 49 | : $this->repository->getDiffOperator()->getChangedFiles( |
| 50 | - $range->from()->id(), |
|
| 51 | - $range->to()->id() |
|
| 52 | - ); |
|
| 50 | + $range->from()->id(), |
|
| 51 | + $range->to()->id() |
|
| 52 | + ); |
|
| 53 | 53 | |
| 54 | 54 | $files = array_merge($files, $filesInDiff); |
| 55 | 55 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $files = []; |
| 42 | 42 | foreach (Git\Range\Detector::getRanges($this->io) as $range) { |
| 43 | - $filesInDiff = isset($options['of-type']) |
|
| 43 | + $filesInDiff = isset($options['of-type']) |
|
| 44 | 44 | ? $this->repository->getDiffOperator()->getChangedFilesOfType( |
| 45 | 45 | $range->from()->id(), |
| 46 | 46 | $range->to()->id(), |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | $hooks = explode(',', $hook); |
| 90 | 90 | $hooks = array_map('trim', $hooks); |
| 91 | 91 | |
| 92 | - $hooksValidationCallback = static function (string $hook): bool { |
|
| 92 | + $hooksValidationCallback = static function(string $hook): bool { |
|
| 93 | 93 | return !HookUtil::isInstallable($hook); |
| 94 | 94 | }; |
| 95 | 95 | if (!empty(($invalidHooks = array_filter($hooks, $hooksValidationCallback)))) { |