Skip to main content

commit_wizard/cli/cmd/push/
mod.rs

1use clap::Args as ClapArgs;
2
3use crate::{
4    cli::CliResult,
5    core::{commit, context::Context},
6};
7
8#[derive(Debug, Clone, ClapArgs)]
9#[command(about = "Push local Git changes while applying Commit Wizard push-time policy checks")]
10pub struct Args {
11    /// Start commit (e.g. tag or hash). If omitted, compare from repo start (or upstream in a later enhancement).
12    #[arg(long)]
13    pub from: Option<String>,
14    /// End commit (default: HEAD)
15    #[arg(long, default_value = "HEAD")]
16    pub to: String,
17    /// Push destination (default: origin)
18    #[arg(long, default_value = "origin")]
19    pub remote: String,
20    /// Branch to push (default: current branch)
21    #[arg(long)]
22    pub branch: Option<String>,
23    /// Permit pushing with no new commits
24    #[arg(long)]
25    pub allow_empty: bool,
26}
27
28pub async fn run(ctx: &Context, args: Args) -> CliResult<()> {
29    commit::push::run(
30        ctx,
31        args.from,
32        args.to,
33        args.remote,
34        args.branch,
35        args.allow_empty,
36    )
37}