summaryrefslogtreecommitdiffstats
path: root/crates/core
diff options
context:
space:
mode:
authorRina Fujino <18257209+rina23q@users.noreply.github.com>2022-02-25 17:27:38 +0100
committerRina Fujino <18257209+rina23q@users.noreply.github.com>2022-02-25 17:43:06 +0100
commite2061a5cf9189467b7279fa5c3dd519f6f5be3d9 (patch)
treeba4e0b2c0fc34af6c59b8bcc9e070fe040bdd1d7 /crates/core
parentfa380f54289338f94a9f89771c4c60a65c697b8b (diff)
Cosmetic fix to print out fullname of a cloud platform for tedge disconnect command
Signed-off-by: Rina Fujino <18257209+rina23q@users.noreply.github.com>
Diffstat (limited to 'crates/core')
-rw-r--r--crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs b/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs
index 9831976e..be6d1df9 100644
--- a/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs
+++ b/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs
@@ -1,6 +1,7 @@
use crate::cli::disconnect::error::*;
use crate::command::*;
use crate::system_services::*;
+use std::fmt;
use std::sync::Arc;
use tedge_config::TEdgeConfigLocation;
use which::which;
@@ -22,11 +23,11 @@ impl Cloud {
}
}
-impl From<Cloud> for String {
- fn from(val: Cloud) -> Self {
- match val {
- Cloud::C8y => "Cumulocity".into(),
- Cloud::Azure => "Azure".into(),
+impl fmt::Display for Cloud {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ Cloud::C8y => write!(f, "Cumulocity"),
+ Cloud::Azure => write!(f, "Azure"),
}
}
}
@@ -43,7 +44,7 @@ pub struct DisconnectBridgeCommand {
impl Command for DisconnectBridgeCommand {
fn description(&self) -> String {
- format!("remove the bridge to disconnect {:?} cloud", self.cloud)
+ format!("remove the bridge to disconnect {} cloud", self.cloud)
}
fn execute(&self) -> anyhow::Result<()> {
@@ -98,7 +99,7 @@ impl DisconnectBridgeCommand {
.join(TEDGE_BRIDGE_CONF_DIR_PATH)
.join(&self.config_file);
- println!("Removing {:?} bridge.\n", self.cloud);
+ println!("Removing {} bridge.\n", self.cloud);
match std::fs::remove_file(&bridge_conf_path) {
// If we find the bridge config file we remove it
// and carry on to see if we need to restart mosquitto.
@@ -127,7 +128,7 @@ impl DisconnectBridgeCommand {
.service_manager()
.restart_service_if_running(SystemService::Mosquitto)?
{
- println!("{:?} Bridge successfully disconnected!\n", self.cloud);
+ println!("{} Bridge successfully disconnected!\n", self.cloud);
}
Ok(())
}