1
1
mirror of https://github.com/orhun/git-cliff.git synced 2024-11-11 02:11:52 +03:00

fix(args): require -u or -l flag for prepending changelog

This commit is contained in:
orhun 2021-06-08 19:01:38 +03:00
parent 57004a123f
commit 3a42f53c8f
No known key found for this signature in database
GPG Key ID: B928720AEC532117
2 changed files with 12 additions and 1 deletions

View File

@ -22,6 +22,9 @@ pub enum Error {
/// Error that may occur while template operations such as parse and render.
#[error("Template error: `{0}`")]
TemplateError(#[from] tera::Error),
/// Error that may occur while parsing the command line arguments.
#[error("Argument error: `{0}`")]
ArgumentError(String),
}
/// Result type of the core library.

View File

@ -5,7 +5,10 @@ use args::Opt;
use changelog::Changelog;
use git_cliff_core::commit::Commit;
use git_cliff_core::config::Config;
use git_cliff_core::error::Result;
use git_cliff_core::error::{
Error,
Result,
};
use git_cliff_core::release::Release;
use git_cliff_core::repo::Repository;
use std::env;
@ -41,6 +44,11 @@ fn main() -> Result<()> {
if args.changelog.is_some() {
config.changelog.footer = None;
if !(args.unreleased || args.latest) {
return Err(Error::ArgumentError(String::from(
"'-u' or '-l' is not specified",
)));
}
}
let repository =