From 654bc16e507be5b75ea64de08acbd1fb82f2c843 Mon Sep 17 00:00:00 2001 From: Valentin Kiselev Date: Thu, 30 Nov 2023 16:03:53 +0300 Subject: [PATCH] docs: add documentation --- docs/configuration.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/configuration.md b/docs/configuration.md index e2273d73..634f6946 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -46,6 +46,7 @@ Lefthook [supports](#config-file) YAML, JSON, and TOML configuration. In this do - [`stage_fixed`](#stage_fixed) - [`interactive`](#interactive) - [`use_stdin`](#use_stdin) + - [`priority`](#priority) - [Script](#script) - [`runner`](#runner) - [`skip`](#skip) @@ -1093,6 +1094,35 @@ Whether to use interactive mode. This applies the certain behavior: If you want to pass stdin to your command or script but don't need to get the input from CLI, use [`use_stdin`](#use_stdin) option instead. +### `priority` + +**Default: 0** + +> This option makes sense only when `parallel: false` or `piped: true` is set. + +> Value `0` is considered an `+Infinity`, so commands with `priority: 0` or without this setting will be run at the very end. + +Set command priority from 1 to +Infinity. This option can be used to configure the order of the sequential commands. + +**Example** + +```yml +# lefthook.yml + +post-checkout: + piped: true + commands: + db-create: + priority: 1 + run: rails db:create + db-migrate: + priority: 2 + run: rails db:migrate + db-seed + priority: 3 + run: rails db:seed +``` + ## Script Scripts are stored under `//` folder. These scripts are your own executables which are being run in the project root (if you don't specify a [`root`](#root) option).