Add the PreCommit hook struct.
This commit is contained in:
parent
1eecfa7146
commit
7a543409ba
|
@ -9,10 +9,12 @@ use {
|
||||||
|
|
||||||
mod exit_action;
|
mod exit_action;
|
||||||
mod general;
|
mod general;
|
||||||
|
mod pre_commit;
|
||||||
mod task;
|
mod task;
|
||||||
|
|
||||||
pub use exit_action::*;
|
pub use exit_action::*;
|
||||||
pub use general::*;
|
pub use general::*;
|
||||||
|
pub use pre_commit::*;
|
||||||
pub use task::*;
|
pub use task::*;
|
||||||
|
|
||||||
/// The main Hooked configuration struct.
|
/// The main Hooked configuration struct.
|
||||||
|
@ -21,6 +23,9 @@ pub use task::*;
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
/// General Hooked configuration.
|
/// General Hooked configuration.
|
||||||
pub general: General,
|
pub general: General,
|
||||||
|
|
||||||
|
/// Pre-commit hooks.
|
||||||
|
pub pre_commit: Vec<PreCommit>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
//! Pre-commit hook definitions.
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::{ExitAction, Task};
|
||||||
|
|
||||||
|
/// A pre-commit hook.
|
||||||
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct PreCommit {
|
||||||
|
/// Display name for this hook.
|
||||||
|
pub name: Option<String>,
|
||||||
|
|
||||||
|
/// What to do when the hook exits with a non-zero status code.
|
||||||
|
pub on_failure: ExitAction,
|
||||||
|
|
||||||
|
/// Task to perform when this hook is called.
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub task: Task,
|
||||||
|
}
|
Loading…
Reference in New Issue