hookman/
lib.rs

1use clap::{Parser, Subcommand};
2use std::path::PathBuf;
3
4/// CLI options for hookman
5#[derive(Parser)]
6#[command(
7    author,
8    version,
9    about = "Install or list git hooks from a TOML config"
10)]
11pub struct Opt {
12    /// Path to the config file
13    #[arg(short, long, default_value = "hookman.toml")]
14    pub config: PathBuf,
15
16    /// Ignore stale hooks inside .git/hooks (removes warning message)
17    #[arg(short, long)]
18    pub ignore_stale: bool,
19
20    #[command(subcommand)]
21    pub command: Command,
22}
23
24/// Available subcommands for hookman
25#[derive(Subcommand)]
26pub enum Command {
27    /// Generate all hooks into .git/hooks
28    Build {
29        /// Use the shell from the current session for the hooks.
30        /// If not set, this will default to /usr/bin/env bash
31        #[arg(short, long)]
32        use_current_shell: bool,
33    },
34    /// List all hooks defined in the config
35    List,
36    /// Delete all hooks defined in the config
37    Clean,
38    /// List all possible events for running hooks
39    ListEvents,
40}