diff --git a/distant-net/src/common/version.rs b/distant-net/src/common/version.rs index 5a2358f..5aa5bbb 100644 --- a/distant-net/src/common/version.rs +++ b/distant-net/src/common/version.rs @@ -114,3 +114,19 @@ impl fmt::Display for Version { write!(f, "{}", self.inner) } } + +impl From for Version { + /// Creates a new [`Version`] using the major, minor, and patch information from + /// [`semver::Version`]. + fn from(version: semver::Version) -> Self { + let mut this = Self::new(version.major, version.minor, version.patch); + this.inner = version; + this + } +} + +impl From for semver::Version { + fn from(version: Version) -> Self { + version.inner + } +} diff --git a/src/lib.rs b/src/lib.rs index 81017da..ce28d58 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,7 +122,7 @@ impl Termination for MainResult { CliError::Exit(code) => ExitCode::from(code), CliError::Error(x) => { match self.format { - Format::Shell => eprintln!("{x}"), + Format::Shell => eprintln!("{x:?}"), Format::Json => println!( "{}", serde_json::to_string(&serde_json::json!({