diff options
author | Rina Fujino <18257209+rina23q@users.noreply.github.com> | 2022-03-01 15:10:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-01 15:10:05 +0100 |
commit | 178dd58cc395d9b40ead1b1820d9f3d2e66fac74 (patch) | |
tree | 3f8b38248c6501c2a20fca3e5ff6bc0a84685a8a /crates/core | |
parent | 9ee1f25e7aab46a54e7eb8a7baefce0cce1dcc35 (diff) | |
parent | e2061a5cf9189467b7279fa5c3dd519f6f5be3d9 (diff) |
Merge pull request #940 Update the output of tedge connect, tutorial and how-to guide
Diffstat (limited to 'crates/core')
-rw-r--r-- | crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs | 17 |
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(()) } |