Make noise_level optional for hooks.
This commit is contained in:
parent
260bcb7ca5
commit
df397b2cda
|
@ -12,8 +12,7 @@ pub struct PreCommit {
|
|||
pub name: Option<String>,
|
||||
|
||||
/// The noise level this task should output with.
|
||||
#[serde(default)]
|
||||
pub noise_level: NoiseLevel,
|
||||
pub noise_level: Option<NoiseLevel>,
|
||||
|
||||
/// What to do when the hook exits with a non-zero status code.
|
||||
#[serde(default)]
|
||||
|
|
|
@ -5,7 +5,6 @@ template = "test.sh"
|
|||
|
||||
[[pre_commit]]
|
||||
name = "Pre Commit 1"
|
||||
noise_level = "quiet"
|
||||
command = "exit 0"
|
||||
staged = ["*.txt"]
|
||||
on_failure = "continue"
|
||||
|
|
|
@ -9,7 +9,7 @@ use insta::assert_snapshot;
|
|||
fn test_serialize() {
|
||||
let pre_commit_command = PreCommit {
|
||||
name: Some("Command Test".to_string()),
|
||||
noise_level: NoiseLevel::Quiet,
|
||||
noise_level: None,
|
||||
on_failure: ExitAction::Continue,
|
||||
staged: vec!["*.txt".to_string()],
|
||||
task: Task {
|
||||
|
@ -20,7 +20,7 @@ fn test_serialize() {
|
|||
|
||||
let pre_commit_script = PreCommit {
|
||||
name: Some("Script Test".to_string()),
|
||||
noise_level: NoiseLevel::Loud,
|
||||
noise_level: Some(NoiseLevel::Loud),
|
||||
on_failure: ExitAction::Stop,
|
||||
staged: vec![],
|
||||
task: Task {
|
||||
|
|
|
@ -12,7 +12,7 @@ Config {
|
|||
pre_commit: [
|
||||
PreCommit {
|
||||
name: None,
|
||||
noise_level: Standard,
|
||||
noise_level: None,
|
||||
on_failure: Stop,
|
||||
staged: [],
|
||||
task: Task {
|
||||
|
|
|
@ -16,7 +16,7 @@ Config {
|
|||
name: Some(
|
||||
"Pre Commit 1",
|
||||
),
|
||||
noise_level: Quiet,
|
||||
noise_level: None,
|
||||
on_failure: Continue,
|
||||
staged: [
|
||||
"*.txt",
|
||||
|
@ -32,7 +32,9 @@ Config {
|
|||
name: Some(
|
||||
"Pre Commit 2",
|
||||
),
|
||||
noise_level: Loud,
|
||||
noise_level: Some(
|
||||
Loud,
|
||||
),
|
||||
on_failure: Stop,
|
||||
staged: [],
|
||||
task: Task {
|
||||
|
|
|
@ -9,7 +9,6 @@ noise_level = 'standard'
|
|||
|
||||
[[pre_commit]]
|
||||
name = 'Command Test'
|
||||
noise_level = 'quiet'
|
||||
on_failure = 'continue'
|
||||
staged = ['*.txt']
|
||||
command = 'exit 0'
|
||||
|
|
Loading…
Reference in New Issue