Skip to content

3x ConsoleCommands

Wtyd edited this page Jun 6, 2024 · 1 revision

GitHooks is based on Laravel Zero Framework which is a micro-framework for console applications. So the way to launch commands in GitHooks is like Laravel's Artisan commands. You can run githooks list to see all available commands.

1. Conf

1.1. conf:init

Creates the configuration file in the root of the project path. You can move to the qa directory. GitHooks will search these two paths for the file githooks.yml.

1.2. conf:check

Check if githooks.yml is in root or qa path. Also check the file format. As the tools can have many options, although the command indicates that the format is correct, there may be errors. Despite this, it can help you correct some errors.

Also, shows a summary of setted jobs and flows:

Conf:check

2. Hook

2.1. hook [$hook=all]

Enable the execution of GitHooks in the hooks setted.

  githooks hook pre-commit # Enable pre-commit hook
  githooks hook # Enable all hooks setted

It is highly recommended to run this command after the composer install and composer update events of the application. In this way you make sure that everyone has the hooks configured at all times. To do this you must add the following lines in the scripts section of composer.json:

"scripts": {
    "post-update-cmd": [
      "vendor/bin/githooks hook"
    ],
    "post-install-cmd": [
      "vendor/bin/githooks hook"
    ]
}

2.2. githooks hook:clean [$hook=all]

Deletes the hook passed as argument (default all).

3. Flows

You can run any flow setted in GitHooks.

githooks flow $flow [--exclude-jobs] [--execution] [--processes] [--fail-fast] [--ignoreErrorsOnExit]
  • exclude-jobs: A list of jobs to exclude from the flow execution.
  • the rest of the arguments are described in the keyword reference section.

If you want to run a single job look at the Job command.

4. Jobs

Allows you to run jobs in isolation. Shows on the screen the command that is launched under the hood. Certain parameters can be overridden by cli, which facilitates the trial/error of a job during its development

githooks job $job [execution] [--executablePath] [--paths] [--otherArguments] [--ignoreErrorsOnExit]

Imagen de una herramienta

Documentation

2.x Documentation (actual)
3.x Documentation (work in progress)

Contributing

Clone this wiki locally