summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Müller <neikos@neikos.email>2023-04-29 17:46:42 +0200
committerMarcel Müller <neikos@neikos.email>2023-04-29 19:57:15 +0200
commit3168eb4492b6bcf66a46f49b58031a7445f60810 (patch)
tree073771b2770b8ac2c1606d7ef92c61f26d6b5ce5
parentf44f46bccb1b2103e2b9a2bb410fe8eba03bc1bd (diff)
Rename generate subcommand to create-release
Signed-off-by: Marcel Müller <neikos@neikos.email>
-rw-r--r--README.md14
-rw-r--r--src/cli.rs2
-rw-r--r--src/command/create_release_command.rs (renamed from src/command/generate_command.rs)4
-rw-r--r--src/command/mod.rs4
-rw-r--r--src/main.rs2
-rw-r--r--tests/generate_command.rs22
-rw-r--r--tests/release_command.rs10
7 files changed, 32 insertions, 26 deletions
diff --git a/README.md b/README.md
index e7496c2..eabf379 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ It works in the following way:
- Everytime you add/change/fix something and want to document it, you create a
new changelog entry with `cargo changelog add`
-- Then, when a new version is released, you run `cargo changelog generate
+- Then, when a new version is released, you run `cargo changelog create-release
<bump>` to move all unreleased changes to either the next patch/minor/major
version
- Finally, you re-generate the CHANGELOG.md file using `cargo changelog release`
@@ -44,13 +44,13 @@ If interactive mode is enabled, which it is per-default, then you will be
prompted to fill in the fields of the changelog as well as a larger free-form
entry where you can explain the motivation and consequences of the changes.
-### cargo changelog generate <bump>
+### cargo changelog create-release <bump>
-Once you are done with one release, `cargo-changelog generate <version>` (for
-example `cargo changelog generate minor` for the next minor version) will take
-all unreleased changelogs and move them to `/.changelogs/0.1.0` (if "0.1.0" is
-your next minor version - you can of course also specify an explicit version
-with the `generate` subcommand).
+Once you are done with one release, `cargo-changelog create-release <version>`
+(for example `cargo changelog create-release minor` for the next minor version)
+will take all unreleased changelogs and move them to `/.changelogs/0.1.0` (if
+"0.1.0" is your next minor version - you can of course also specify an explicit
+version with the `create-release` subcommand).
### cargo changelog release
diff --git a/src/cli.rs b/src/cli.rs
index a0f01cc..806b970 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -74,7 +74,7 @@ pub enum Command {
/// Use the current unreleased changelog fragments to generate the changelog for the next
/// release
#[clap(subcommand)]
- Generate(VersionSpec),
+ CreateRelease(VersionSpec),
/// Generate the changelog file from the fragments marked for release
Release {
diff --git a/src/command/generate_command.rs b/src/command/create_release_command.rs
index 1d33bbc..a091701 100644
--- a/src/command/generate_command.rs
+++ b/src/command/create_release_command.rs
@@ -5,11 +5,11 @@ use crate::{
};
#[derive(Debug, typed_builder::TypedBuilder)]
-pub struct GenerateCommand {
+pub struct CreateReleaseCommand {
version: VersionSpec,
}
-impl crate::command::Command for GenerateCommand {
+impl crate::command::Command for CreateReleaseCommand {
fn execute(self, workdir: &Path, config: &Configuration) -> Result<(), Error> {
let version_string = find_version_string(workdir, &self.version)?;
log::debug!("Creating new directory for version '{}'", version_string);
diff --git a/src/command/mod.rs b/src/command/mod.rs
index 0513dfe..e2419dc 100644
--- a/src/command/mod.rs
+++ b/src/command/mod.rs
@@ -7,8 +7,8 @@ mod common;
mod add_command;
pub use self::add_command::AddCommand;
-mod generate_command;
-pub use self::generate_command::GenerateCommand;
+mod create_release_command;
+pub use self::create_release_command::CreateReleaseCommand;
mod release_command;
pub use self::release_command::ReleaseCommand;
diff --git a/src/main.rs b/src/main.rs
index 83eafbc..7f0f2ef 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -77,7 +77,7 @@ fn main() -> miette::Result<()> {
.build()
.execute(&repo_workdir_path, &config)?,
- Command::Generate(version) => crate::command::GenerateCommand::builder()
+ Command::CreateRelease(version) => crate::command::CreateReleaseCommand::builder()
.version(version)
.build()
.execute(&repo_workdir_path, &config)?,
diff --git a/tests/generate_command.rs b/tests/generate_command.rs
index 2f340ac..9a59409 100644
--- a/tests/generate_command.rs
+++ b/tests/generate_command.rs
@@ -5,13 +5,16 @@ use assert_cmd::Command;
mod common;
#[test]
-fn generate_command_creates_new_directory() {
+fn create_release_command_creates_new_directory() {
let temp_dir = tempfile::Builder::new()
.prefix("cargo-changelog")
.tempdir()
.unwrap();
self::common::init_git(temp_dir.path());
- self::common::init_cargo(temp_dir.path(), "cargo-changelog-testpkg-generatecommand");
+ self::common::init_cargo(
+ temp_dir.path(),
+ "cargo-changelog-testpkg-create-release_command",
+ );
self::common::init_cargo_changelog(temp_dir.path());
let unreleased_dir = temp_dir.path().join(".changelogs").join("unreleased");
@@ -19,10 +22,10 @@ fn generate_command_creates_new_directory() {
panic!("Unreleased directory does not exist");
}
- // call `cargo-changelog generate`
+ // call `cargo-changelog create-release`
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(["generate", "minor"])
+ .args(["create-release", "minor"])
.current_dir(&temp_dir)
.assert()
.success();
@@ -34,13 +37,16 @@ fn generate_command_creates_new_directory() {
}
#[test]
-fn generate_command_moves_from_unreleased_dir() {
+fn create_release_command_moves_from_unreleased_dir() {
let temp_dir = tempfile::Builder::new()
.prefix("cargo-changelog")
.tempdir()
.unwrap();
self::common::init_git(temp_dir.path());
- self::common::init_cargo(temp_dir.path(), "cargo-changelog-testpkg-generatecommand");
+ self::common::init_cargo(
+ temp_dir.path(),
+ "cargo-changelog-testpkg-create-release_command",
+ );
self::common::init_cargo_changelog(temp_dir.path());
self::common::cargo_changelog_add(temp_dir.path())
@@ -80,10 +86,10 @@ fn generate_command_moves_from_unreleased_dir() {
panic!("Release directory should not exist yet");
}
- // call `cargo-changelog generate`
+ // call `cargo-changelog create-release`
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(["generate", "minor"])
+ .args(["create-release", "minor"])
.current_dir(&temp_dir)
.assert()
.success();
diff --git a/tests/release_command.rs b/tests/release_command.rs
index 960917b..7fbb413 100644
--- a/tests/release_command.rs
+++ b/tests/release_command.rs
@@ -29,12 +29,12 @@ fn release_command_works() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(["generate", "minor"])
+ .args(["create-release", "minor"])
.current_dir(&temp_dir)
.assert()
.success();
- // call `cargo-changelog generate`
+ // call `cargo-changelog create-release`
Command::cargo_bin("cargo-changelog")
.unwrap()
.args(["release"])
@@ -101,12 +101,12 @@ fn release_command_works_for_alpha_release() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(["generate", "custom", "0.1.0-alpha.1"])
+ .args(["create-release", "custom", "0.1.0-alpha.1"])
.current_dir(&temp_dir)
.assert()
.success();
- // call `cargo-changelog generate`
+ // call `cargo-changelog create-release`
Command::cargo_bin("cargo-changelog")
.unwrap()
.args(["release"])
@@ -190,7 +190,7 @@ fn release_command_works_with_suffix() {
Command::cargo_bin("cargo-changelog")
.unwrap()
- .args(["generate", "custom", "0.1.0-alpha.1"])
+ .args(["create-release", "custom", "0.1.0-alpha.1"])
.current_dir(&temp_dir)
.assert()
.success();