Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datashed: cleanup version command #32

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions crates/datashed/src/commands/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ use clap::Parser;

use crate::prelude::*;

/// Get or set the version of the data pod.
/// Get or set the version of the datashed.
#[derive(Debug, Parser)]
pub(crate) struct Version {
/// Whether to overwrite the current version or not.
#[arg(short, long)]
force: bool,

/// The new version of the data pod. Unless the `--force` option is
/// set, the new version must be greater than the current version.
/// The new version of the datashed. Unless the `--force`/`-f`
/// option is set, the new version must be greater than the
/// current version. A datashed version consists of three
/// separated integers, which must conform to the semantic
/// versioning standard; invalid version strings are rejected.
version: Option<semver::Version>,
}

Expand All @@ -21,11 +24,8 @@ impl Version {

if let Some(version) = self.version {
if !self.force && version <= config.metadata.version {
bail!(
"{} must be greater than {}",
version,
config.metadata.version
);
let current = config.metadata.version.to_string();
bail!("{version} must be greater than {current}");
}

config.metadata.version = version;
Expand Down