changelog: added changelog

This commit is contained in:
2025-11-26 21:30:34 +01:00
parent e6fb4607c4
commit a4d2441b0a
3 changed files with 364 additions and 2 deletions

View File

@@ -16,6 +16,9 @@ use cmd_lib::{run_cmd};
mod get;
use get::get;
mod changelog;
use changelog::generate_entry;
fn main() {
let rt = tokio::runtime::Runtime::new().unwrap();
let matches = command!()
@@ -39,7 +42,7 @@ fn main() {
.arg(arg!(<package> "Target package"))
)
.subcommand(
Command::new("changelog")
Command::new("chlog")
.about("Auto-generate changelog entry, editing it, committing it afterwards")
.arg(arg!(-s --series <series> "Target distribution series").required(false))
.arg(arg!(--backport "This changelog is for a backport entry").required(false))
@@ -61,7 +64,20 @@ fn main() {
std::process::exit(1);
}
},
Some(("changelog", _sub_matches)) => {
Some(("chlog", sub_matches)) => {
let cwd = std::env::current_dir().unwrap();
let version = sub_matches.get_one::<String>("version").map(|s| s.as_str());
if let Err(e) = generate_entry("debian/changelog", Some(&cwd), version) {
eprintln!("Error: {}", e);
std::process::exit(1);
}
let editor = std::env::var("EDITOR").unwrap();
let _status = std::process::Command::new(editor)
.current_dir(&cwd)
.args(&["debian/changelog"])
.status();
},
_ => unreachable!("Exhausted list of subcommands and subcommand_required prevents `None`"),
}