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)]
|
||||
#[serde(default, deny_unknown_fields)]
|
||||
pub struct General {
|
||||
/// Path to the Hooked configuration file.
|
||||
pub config: PathBuf,
|
||||
|
||||
/// The directory to use for hooks.
|
||||
pub directory: PathBuf,
|
||||
}
|
||||
|
@ -15,6 +18,7 @@ pub struct General {
|
|||
impl Default for General {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
config: PathBuf::from("Hooked.toml"),
|
||||
directory: PathBuf::from("hooks"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
source: tests/parsing.rs
|
||||
source: hooked-config/tests/parsing.rs
|
||||
expression: config
|
||||
---
|
||||
Config {
|
||||
general: General {
|
||||
config: "Hooked.toml",
|
||||
directory: "hooks",
|
||||
},
|
||||
pre_commit: [
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
---
|
||||
source: tests/parsing.rs
|
||||
source: hooked-config/tests/parsing.rs
|
||||
expression: config
|
||||
---
|
||||
Config {
|
||||
general: General {
|
||||
config: "Hooked.toml",
|
||||
directory: "hooked",
|
||||
},
|
||||
pre_commit: [
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
---
|
||||
source: tests/serialize.rs
|
||||
source: hooked-config/tests/serialize.rs
|
||||
expression: to_string_pretty(&config).unwrap()
|
||||
---
|
||||
[general]
|
||||
config = 'Hooked.toml'
|
||||
directory = 'hooks'
|
||||
|
||||
[[pre_commit]]
|
||||
|
|
Loading…
Reference in New Issue