Add config file configuration.
This commit is contained in:
parent
b386e59c3e
commit
4dab507636
|
@ -8,6 +8,9 @@ use serde::{Deserialize, Serialize};
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
#[serde(default, deny_unknown_fields)]
|
#[serde(default, deny_unknown_fields)]
|
||||||
pub struct General {
|
pub struct General {
|
||||||
|
/// Path to the Hooked configuration file.
|
||||||
|
pub config: PathBuf,
|
||||||
|
|
||||||
/// The directory to use for hooks.
|
/// The directory to use for hooks.
|
||||||
pub directory: PathBuf,
|
pub directory: PathBuf,
|
||||||
}
|
}
|
||||||
|
@ -15,6 +18,7 @@ pub struct General {
|
||||||
impl Default for General {
|
impl Default for General {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
config: PathBuf::from("Hooked.toml"),
|
||||||
directory: PathBuf::from("hooks"),
|
directory: PathBuf::from("hooks"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
---
|
---
|
||||||
source: tests/parsing.rs
|
source: hooked-config/tests/parsing.rs
|
||||||
expression: config
|
expression: config
|
||||||
---
|
---
|
||||||
Config {
|
Config {
|
||||||
general: General {
|
general: General {
|
||||||
|
config: "Hooked.toml",
|
||||||
directory: "hooks",
|
directory: "hooks",
|
||||||
},
|
},
|
||||||
pre_commit: [
|
pre_commit: [
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
---
|
---
|
||||||
source: tests/parsing.rs
|
source: hooked-config/tests/parsing.rs
|
||||||
expression: config
|
expression: config
|
||||||
---
|
---
|
||||||
Config {
|
Config {
|
||||||
general: General {
|
general: General {
|
||||||
|
config: "Hooked.toml",
|
||||||
directory: "hooked",
|
directory: "hooked",
|
||||||
},
|
},
|
||||||
pre_commit: [
|
pre_commit: [
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
---
|
---
|
||||||
source: tests/serialize.rs
|
source: hooked-config/tests/serialize.rs
|
||||||
expression: to_string_pretty(&config).unwrap()
|
expression: to_string_pretty(&config).unwrap()
|
||||||
---
|
---
|
||||||
[general]
|
[general]
|
||||||
|
config = 'Hooked.toml'
|
||||||
directory = 'hooks'
|
directory = 'hooks'
|
||||||
|
|
||||||
[[pre_commit]]
|
[[pre_commit]]
|
||||||
|
|
Loading…
Reference in New Issue