2026-03-07 00:53:13 +01:00
|
|
|
use clap::Parser;
|
2026-02-05 20:34:57 +01:00
|
|
|
|
2026-03-07 00:53:13 +01:00
|
|
|
/// Interactive conventional commit tool for Jujutsu
|
|
|
|
|
///
|
|
|
|
|
/// Guides you through creating a properly formatted conventional commit message
|
|
|
|
|
/// and applies it to the current change in your Jujutsu repository.
|
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
|
#[command(
|
|
|
|
|
name = "jj-cz",
|
|
|
|
|
version,
|
|
|
|
|
about = "Interactive conventional commit tool for Jujutsu",
|
|
|
|
|
long_about = "Guides you through creating a properly formatted conventional \
|
|
|
|
|
commit message and applies it to the current change in your \
|
|
|
|
|
Jujutsu repository.\n\n\
|
|
|
|
|
This tool requires an interactive terminal (TTY)."
|
|
|
|
|
)]
|
2026-04-05 23:02:14 +02:00
|
|
|
pub struct Cli {
|
|
|
|
|
/// The revision(s) whose description to edit (default: @)
|
|
|
|
|
#[arg(value_name = "REVSETS")]
|
|
|
|
|
revsets: Vec<String>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Cli {
|
|
|
|
|
/// Returns the revsets to operate on, defaulting to `["@"]` if none provided
|
|
|
|
|
pub fn revsets(&self) -> Vec<&str> {
|
|
|
|
|
if self.revsets.is_empty() {
|
|
|
|
|
vec!["@"]
|
|
|
|
|
} else {
|
|
|
|
|
self.revsets.iter().map(|s| s.as_str()).collect()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|