diff --git a/Cargo.toml b/Cargo.toml index 39a9bcb..744fdce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,8 +2,19 @@ name = "cargo-semver" version = "0.1.0" edition = "2021" +keywords = ["cargo", "semver"] +categories = [ + "development-tools", + "development-tools::cargo-plugins", + "development-tools::build-utils", + "command-line-utilities", +] + +[[bin]] +name = "cargo-semver" +path = "src/main.rs" [dependencies] toml_edit = { version = "0.22.20" } semver = { version = "1.0.23" } -clap = { version = "4.5.16", features = ["derive"] } +clap = { version = "4.5.16", features = ["derive", "cargo"] } diff --git a/src/main.rs b/src/main.rs index de99f3f..7f158dd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,9 +4,16 @@ use clap::{command, Parser}; use semver::Version; use toml_edit::{value, DocumentMut}; +#[derive(Parser)] +#[command(name = "cargo")] +#[command(bin_name = "cargo")] +enum CargoCli { + Semver(SemverArgs), +} + #[derive(Clone, Debug, Parser, PartialEq, Eq)] #[command(version, about, long_about = None)] -pub struct CliArgs { +pub struct SemverArgs { #[arg(long("bump-patch"), default_value_t = false)] pub bump_patch: bool, @@ -18,7 +25,7 @@ pub struct CliArgs { } fn main() { - let args = CliArgs::parse(); + let CargoCli::Semver(args) = CargoCli::parse(); if !args.bump_major && !args.bump_minor && !args.bump_patch { panic!("Specify which version to bump by using --bump-patch --bump-minor or --bump-major");