Skip to content

Commit

Permalink
datashed: cleanup version command (#32)
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Wagner <[email protected]>
  • Loading branch information
nwagner84 authored Jul 15, 2024
1 parent 80d0f33 commit 3224530
Showing 1 changed file with 8 additions and 8 deletions.
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

0 comments on commit 3224530

Please sign in to comment.