Compare commits
No commits in common. "06899c42c7f49d063f2e6143edc641e95403744c" and "4f28ced1b1e44bbbccda4e01ba882c756f683ed2" have entirely different histories.
06899c42c7
...
4f28ced1b1
|
@ -1,3 +0,0 @@
|
|||
[[pre_commit]]
|
||||
name = "Cargo Complete Check"
|
||||
command = "cargo make complete-check"
|
|
@ -10,8 +10,6 @@ use {
|
|||
supports_color::Stream,
|
||||
};
|
||||
|
||||
use crate::utilities::plural;
|
||||
|
||||
/// The `run` subcommand.
|
||||
pub fn hooked_run(config: Config, hook_type: String) -> Result<()> {
|
||||
let (success_style, warn_style, error_style) =
|
||||
|
@ -27,11 +25,9 @@ pub fn hooked_run(config: Config, hook_type: String) -> Result<()> {
|
|||
};
|
||||
|
||||
if hook_type == "pre-commit" {
|
||||
let hook_count = config.pre_commit.len();
|
||||
println!(
|
||||
"Hooked: Running {} pre-commit {}.",
|
||||
hook_count,
|
||||
plural(hook_count, "hook", None)
|
||||
"Hooked: Running {} pre-commit hooks.",
|
||||
config.pre_commit.len()
|
||||
);
|
||||
|
||||
for hook in config.pre_commit {
|
||||
|
|
|
@ -27,7 +27,6 @@ pub const DEFAULT_TEMPLATE: &str = include_str!("templates/default.sh");
|
|||
pub const HOOK_TYPES: [&str; 1] = ["pre-commit"];
|
||||
|
||||
mod cli;
|
||||
mod utilities;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
install()?;
|
||||
|
@ -45,7 +44,6 @@ fn main() -> Result<()> {
|
|||
|
||||
for hook_type in HOOK_TYPES {
|
||||
let mut context = Context::new();
|
||||
context.insert("config_path", &config.general.config);
|
||||
context.insert("hook_type", hook_type);
|
||||
|
||||
let hook_path = git_hooks_dir.join(hook_type);
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
# Installed by Hooked.
|
||||
|
||||
hooked run {{ hook_type }} --config {{ config_path }}
|
||||
hooked run {{ hook_type }}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
//! Miscellaneous utilities.
|
||||
|
||||
/// Simple function to create a pluralized string.
|
||||
pub fn plural(count: usize, singular: &str, plural: Option<&str>) -> String {
|
||||
if count == 1 {
|
||||
return singular.to_string();
|
||||
}
|
||||
|
||||
if let Some(plural) = plural {
|
||||
return plural.to_string();
|
||||
}
|
||||
|
||||
format!("{singular}s")
|
||||
}
|
|
@ -8,9 +8,6 @@ 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,
|
||||
}
|
||||
|
@ -18,7 +15,6 @@ pub struct General {
|
|||
impl Default for General {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
config: PathBuf::from("Hooked.toml"),
|
||||
directory: PathBuf::from("hooks"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
source: hooked-config/tests/parsing.rs
|
||||
source: tests/parsing.rs
|
||||
expression: config
|
||||
---
|
||||
Config {
|
||||
general: General {
|
||||
config: "Hooked.toml",
|
||||
directory: "hooks",
|
||||
},
|
||||
pre_commit: [
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
---
|
||||
source: hooked-config/tests/parsing.rs
|
||||
source: tests/parsing.rs
|
||||
expression: config
|
||||
---
|
||||
Config {
|
||||
general: General {
|
||||
config: "Hooked.toml",
|
||||
directory: "hooked",
|
||||
},
|
||||
pre_commit: [
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
---
|
||||
source: hooked-config/tests/serialize.rs
|
||||
source: tests/serialize.rs
|
||||
expression: to_string_pretty(&config).unwrap()
|
||||
---
|
||||
[general]
|
||||
config = 'Hooked.toml'
|
||||
directory = 'hooks'
|
||||
|
||||
[[pre_commit]]
|
||||
|
|
Loading…
Reference in New Issue