1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-12-16 02:02:18 +03:00

refactor(args): add possible values to strip argument

This commit is contained in:
orhun 2021-06-08 18:26:24 +03:00
parent 05d522985b
commit 57004a123f
No known key found for this signature in database
GPG Key ID: B928720AEC532117
2 changed files with 18 additions and 7 deletions

View File

@ -44,9 +44,9 @@ pub struct Opt {
/// Processes the commits that do not belong to a tag.
#[structopt(short, long)]
pub unreleased: bool,
/// Strips the header and footer from the changelog.
#[structopt(short, long)]
pub strip: bool,
/// Strips the given parts from the changelog.
#[structopt(short, long, possible_values = &["header", "footer", "all"])]
pub strip: Option<String>,
/// Sets the commit range to process.
pub range: Option<String>,
}

View File

@ -25,10 +25,21 @@ fn main() -> Result<()> {
pretty_env_logger::init();
let mut config = Config::parse(args.config)?;
if args.strip {
match args.strip.as_deref() {
Some("header") => {
config.changelog.header = None;
}
Some("footer") => {
config.changelog.footer = None;
}
Some("all") => {
config.changelog.header = None;
config.changelog.footer = None;
} else if args.changelog.is_some() {
}
_ => {}
}
if args.changelog.is_some() {
config.changelog.footer = None;
}