1use clap::{Parser, Subcommand};
4
5pub mod changelog;
6pub mod commit;
7pub mod config;
8pub mod init;
9pub mod log;
10pub mod release;
11mod util;
12pub mod version;
13
14#[derive(Debug, Parser)]
15#[clap(
16 version,
17 about = "Misc. tools for conventional commits, versioning, and changelogs"
18)]
19#[clap(propagate_version = true)]
20pub struct Cli {
21 #[clap(subcommand)]
22 pub commands: Commands,
23}
24
25#[derive(Debug, Subcommand)]
26pub enum Commands {
27 Init(init::InitArgs),
29 Config(config::ConfigArgs),
31 Commit(commit::CommitArgs),
33 Log(log::LogArgs),
35 Version(version::VersionArgs),
37 Changelog(changelog::ChangelogArgs),
39 Release(release::ReleaseArgs),
41}
42
43pub fn exec(cli: Cli) -> anyhow::Result<()> {
45 match cli.commands {
46 Commands::Init(args) => init::run(args),
47 Commands::Config(args) => config::run(args),
48 Commands::Commit(args) => commit::run(args),
49 Commands::Version(args) => version::run(args),
50 Commands::Log(args) => log::run(args),
51 Commands::Changelog(args) => changelog::run(args),
52 Commands::Release(args) => release::run(args),
53 }
54}