Skip to content

Commit

Permalink
refactor(args): rename changelog argument to prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Jul 21, 2021
1 parent 8232111 commit 5a5a042
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions git-cliff/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub struct Opt {
#[structopt(short, long, env, value_name = "PATH")]
pub repository: Option<PathBuf>,
/// Prepends entries to the given changelog file.
#[structopt(short = "p", long, env, value_name = "PATH")]
pub changelog: Option<PathBuf>,
#[structopt(short, long, env, value_name = "PATH")]
pub prepend: Option<PathBuf>,
/// Writes output to the given file.
#[structopt(short, long, env, value_name = "PATH")]
pub output: Option<PathBuf>,
Expand Down
8 changes: 4 additions & 4 deletions git-cliff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ pub fn run(mut args: Opt) -> Result<()> {
Some(repository) => Some(workdir.join(repository)),
None => Some(workdir.clone()),
};
if let Some(changelog) = args.changelog {
args.changelog = Some(workdir.join(changelog));
if let Some(changelog) = args.prepend {
args.prepend = Some(workdir.join(changelog));
}
}

Expand All @@ -60,7 +60,7 @@ pub fn run(mut args: Opt) -> Result<()> {
}
_ => {}
}
if args.changelog.is_some() {
if args.prepend.is_some() {
config.changelog.footer = None;
if !(args.unreleased || args.latest) {
return Err(Error::ArgumentError(String::from(
Expand Down Expand Up @@ -133,7 +133,7 @@ pub fn run(mut args: Opt) -> Result<()> {

// Generate changelog.
let changelog = Changelog::new(releases, &config)?;
if let Some(path) = args.changelog {
if let Some(path) = args.prepend {
changelog.prepend(fs::read_to_string(&path)?, &mut File::create(path)?)
} else if let Some(path) = args.output {
changelog.generate(&mut File::create(path)?)
Expand Down

0 comments on commit 5a5a042

Please sign in to comment.