g/src/args.rs
JMARyA aa231276af
All checks were successful
ci/woodpecker/push/build Pipeline was successful
verify scripts
2025-04-10 18:33:18 +02:00

95 lines
3.2 KiB
Rust

use clap::{arg, command};
pub fn get_args() -> clap::ArgMatches {
command!()
.about("Git wrapper")
.subcommand(
command!("bootstrap")
.about("Bootstrap a new repository from base repository")
.arg(arg!(<BASE> "Base repository").required(true))
.arg(arg!(<NEW> "Repository name").required(true))
.arg(arg!(--verify "Verify scripts before running them"))
.alias("bs"),
)
.subcommand(
command!("todo")
.about("Show open TODOs in repository")
.alias("t")
.arg(arg!(-c --count "Only show TODO count")),
)
.subcommand(
command!("new")
.about("Create a new branch")
.arg(arg!(<BRANCH> "Branch name").required(true))
.alias("n"),
)
.subcommand(
command!("revert")
.about("Revert n commits into the past")
.arg(arg!(<N> "Number of commits")),
)
.subcommand(
command!("commit")
.about("Commit current changes")
.alias("c")
.arg(arg!(-f --force "Force commit and skip any checks"))
.arg(arg!(-a --all "Add all changed files to commit"))
.arg(
arg!(-d --done "Only allow commiting if no TODOs are present")
.conflicts_with("force"),
)
.arg(
arg!(-i --interactive "Write interactive commit message with gitmoji standard")
.conflicts_with("message"),
)
.arg(arg!(-m --message <MSG> "Commit message").required(false)),
)
.subcommand(
command!("remove")
.about("Remove a branch")
.arg(arg!(<BRANCH> "Branch name").required(true))
.alias("r"),
)
.subcommand(
command!("branch")
.about("Show branches or switch to one")
.alias("b")
.arg(arg!(<BRANCH> "Branch name").required(false)),
)
.subcommand(
command!()
.name("push")
.about("Push to a remote")
.arg(arg!(-f --force "Force push")),
)
.subcommand(
command!()
.name("status")
.about("Show git status")
.alias("s")
.alias("stat")
.alias("stats"),
)
.subcommand(
command!()
.name("add")
.about("Add files to git")
.alias("a")
.arg(arg!(<FILE> "File to add").required(true)),
)
.subcommand(
command!()
.name("fetch")
.about("Run git fetch --prune")
.alias("f"),
)
.subcommand(command!().name("pull").about("Run git pull --prune"))
.subcommand(
command!()
.name("log")
.about("Show git commit log")
.alias("l"),
)
.subcommand(command!().name("save").about("Create a WIP commit"))
.get_matches()
}