Compare commits
5 Commits
d12895184b
...
87c53d5e09
Author | SHA1 | Date |
---|---|---|
Bauke | 87c53d5e09 | |
Bauke | dff366f9a0 | |
Bauke | 595b8c25c1 | |
Bauke | caa158ce9f | |
Bauke | b98426a993 |
|
@ -1,3 +1,7 @@
|
||||||
[[pre_commit]]
|
[[pre_commit]]
|
||||||
name = "Cargo Complete Check"
|
name = "Cargo Complete Check"
|
||||||
command = "cargo make complete-check"
|
command = "cargo make complete-check"
|
||||||
|
|
||||||
|
[[pre_commit]]
|
||||||
|
name = "Typos"
|
||||||
|
command = "typos"
|
||||||
|
|
|
@ -1,32 +1,18 @@
|
||||||
[env]
|
[env]
|
||||||
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
||||||
|
|
||||||
[tasks.fmt]
|
|
||||||
command = "cargo"
|
|
||||||
args = ["fmt", "${@}"]
|
|
||||||
|
|
||||||
[tasks.check]
|
|
||||||
command = "cargo"
|
|
||||||
args = ["check", "${@}"]
|
|
||||||
|
|
||||||
[tasks.clippy]
|
|
||||||
command = "cargo"
|
|
||||||
args = ["clippy", "${@}"]
|
|
||||||
|
|
||||||
[tasks.test]
|
|
||||||
command = "cargo"
|
|
||||||
args = ["test", "${@}"]
|
|
||||||
|
|
||||||
[tasks.doc]
|
|
||||||
command = "cargo"
|
|
||||||
args = ["doc", "${@}"]
|
|
||||||
|
|
||||||
[tasks.build]
|
|
||||||
command = "cargo"
|
|
||||||
args = ["build", "${@}"]
|
|
||||||
|
|
||||||
[tasks.complete-check]
|
[tasks.complete-check]
|
||||||
dependencies = ["fmt", "check", "clippy", "test", "doc", "build"]
|
dependencies = [
|
||||||
|
"format",
|
||||||
|
"check",
|
||||||
|
"clippy",
|
||||||
|
"test",
|
||||||
|
"code-coverage",
|
||||||
|
"docs",
|
||||||
|
"build",
|
||||||
|
"audit-flow",
|
||||||
|
"outdated-flow",
|
||||||
|
]
|
||||||
|
|
||||||
[tasks.code-coverage]
|
[tasks.code-coverage]
|
||||||
workspace = false
|
workspace = false
|
||||||
|
@ -38,7 +24,7 @@ args = [
|
||||||
"--out=html",
|
"--out=html",
|
||||||
"--output-dir=coverage",
|
"--output-dir=coverage",
|
||||||
"--skip-clean",
|
"--skip-clean",
|
||||||
"--target-dir=target/tarpaulin"
|
"--target-dir=target/tarpaulin",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tasks.book]
|
[tasks.book]
|
||||||
|
|
|
@ -15,6 +15,7 @@ use crate::{cli::InstallArgs, DEFAULT_TEMPLATE, HOOK_TYPES};
|
||||||
|
|
||||||
/// The `install` subcommand.
|
/// The `install` subcommand.
|
||||||
pub fn hooked_install(config: Config, args: InstallArgs) -> Result<()> {
|
pub fn hooked_install(config: Config, args: InstallArgs) -> Result<()> {
|
||||||
|
let silent = args.silent;
|
||||||
let git_hooks_dir = PathBuf::from(".git/hooks/");
|
let git_hooks_dir = PathBuf::from(".git/hooks/");
|
||||||
if !git_hooks_dir.exists() {
|
if !git_hooks_dir.exists() {
|
||||||
return Err(eyre!("The \".git/hooks/\" directory does not exist"));
|
return Err(eyre!("The \".git/hooks/\" directory does not exist"));
|
||||||
|
@ -28,10 +29,12 @@ pub fn hooked_install(config: Config, args: InstallArgs) -> Result<()> {
|
||||||
|
|
||||||
let hook_path = git_hooks_dir.join(hook_type);
|
let hook_path = git_hooks_dir.join(hook_type);
|
||||||
if hook_path.exists() && !args.overwrite {
|
if hook_path.exists() && !args.overwrite {
|
||||||
|
if !silent {
|
||||||
println!(
|
println!(
|
||||||
"{:?} exists, use --overwrite to replace the existing file",
|
"{:?} exists, use --overwrite to replace the existing file",
|
||||||
hook_path
|
hook_path
|
||||||
);
|
);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,10 @@ pub struct InstallArgs {
|
||||||
/// Overwrite existing files.
|
/// Overwrite existing files.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub overwrite: bool,
|
pub overwrite: bool,
|
||||||
|
|
||||||
|
/// Don't output any information.
|
||||||
|
#[clap(long)]
|
||||||
|
pub silent: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The `uninstall` subcommand arguments.
|
/// The `uninstall` subcommand arguments.
|
||||||
|
|
|
@ -23,7 +23,7 @@ pub struct PrintStyles {
|
||||||
pub error: Style,
|
pub error: Style,
|
||||||
/// The style for skipped hooks output.
|
/// The style for skipped hooks output.
|
||||||
pub skipped: Style,
|
pub skipped: Style,
|
||||||
/// The style for succesful hooks output.
|
/// The style for successful hooks output.
|
||||||
pub success: Style,
|
pub success: Style,
|
||||||
/// The style for hooks with warnings.
|
/// The style for hooks with warnings.
|
||||||
pub warn: Style,
|
pub warn: Style,
|
||||||
|
|
|
@ -7,11 +7,16 @@ let
|
||||||
in
|
in
|
||||||
mkShell rec {
|
mkShell rec {
|
||||||
packages = [
|
packages = [
|
||||||
|
cargo-audit
|
||||||
cargo-edit
|
cargo-edit
|
||||||
|
cargo-insta
|
||||||
cargo-make
|
cargo-make
|
||||||
|
cargo-outdated
|
||||||
|
cargo-tarpaulin
|
||||||
mdbook
|
mdbook
|
||||||
mdbook-linkcheck
|
mdbook-linkcheck
|
||||||
rustup-toolchain
|
rustup-toolchain
|
||||||
|
typos
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
@ -23,6 +28,6 @@ mkShell rec {
|
||||||
cargo install --path hooked-cli --root $out
|
cargo install --path hooked-cli --root $out
|
||||||
fi
|
fi
|
||||||
|
|
||||||
hooked install
|
hooked install --silent
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue