@smbcloud / cli / commits / a52a71c

unify styles

Seto Elkahfi committed May 27, 2025 at 19:24 UTC a52a71c6ca17164433b64a11e754059c1b8afd94
2 files changed +27 -30
crates/cli/src/account/forgot/mod.rs
+16 -16
@@ -1,4 +1,7 @@
1 -use crate::{cli::CommandResult, ui::{fail_message, fail_symbol}};
1 +use crate::{
2 + cli::CommandResult,
3 + ui::{fail_message, fail_symbol, succeed_message, succeed_symbol},
4 +};
5 use anyhow::Result;
6 use console::style;
7 use dialoguer::{theme::ColorfulTheme, Input, Password};
@@ -36,8 +39,8 @@ pub async fn process_forgot(env: Environment) -> Result<CommandResult> {
39 match response.status() {
40 StatusCode::OK => {
41 spinner.stop_and_persist(
39 - "✅",
40 - "Check your email and input your code here.".to_owned(),
42 + &succeed_symbol(),
43 + succeed_message("Check your email and input your code here."),
44 );
45 input_code(env).await
46 }
@@ -56,8 +59,8 @@ async fn input_code(env: Environment) -> Result<CommandResult> {
59 .unwrap();
60
61 Spinner::new(
59 - spinners::Spinners::SimpleDotsScrolling,
60 - style("Checking your code...").green().bold().to_string(),
62 + spinners::Spinners::Hamburger,
63 + succeed_message("Checking your code."),
64 )
65 .stop_and_persist("✅", "Great. Now input your new password.".to_owned());
66
@@ -85,11 +88,8 @@ async fn input_code(env: Environment) -> Result<CommandResult> {
88 };
89
90 let spinner = Spinner::new(
88 - spinners::Spinners::SimpleDotsScrolling,
89 - style("Updating your password...")
90 - .green()
91 - .bold()
92 - .to_string(),
91 + spinners::Spinners::Hamburger,
92 + succeed_message("Updating your password."),
93 );
94
95 let response = Client::new()
@@ -107,18 +107,18 @@ async fn input_code(env: Environment) -> Result<CommandResult> {
107 match response.status() {
108 StatusCode::OK => Ok(CommandResult {
109 spinner,
110 - symbol: "✅".to_owned(),
111 - msg: "Your password has been updated. Login with your new password.".to_owned(),
110 + symbol: succeed_symbol(),
111 + msg: succeed_message("Your password has been updated. Login with your new password."),
112 }),
113 StatusCode::NOT_FOUND => Ok(CommandResult {
114 spinner,
115 - symbol: "😩".to_owned(),
116 - msg: "URL not found.".to_owned(),
115 + symbol: fail_symbol(),
116 + msg: fail_message("URL not found."),
117 }),
118 _ => Ok(CommandResult {
119 spinner,
120 - symbol: "😩".to_owned(),
121 - msg: "Something wrong when trying to reset email.".to_owned(),
120 + symbol: fail_symbol(),
121 + msg: fail_message("Something wrong when trying to reset email."),
122 }),
123 }
124 }
crates/cli/src/account/login/process.rs
+11 -14
@@ -179,8 +179,8 @@ async fn send_email_verification(env: Environment, user: Option<User>) -> Result
179 );
180 return Ok(CommandResult {
181 spinner,
182 - symbol: "✅".to_owned(),
183 - msg: "Doing nothing.".to_owned(),
182 + symbol: succeed_symbol(),
183 + msg: succeed_message("Doing nothing."),
184 });
185 }
186 resend_email_verification(env, user).await
@@ -210,8 +210,8 @@ async fn resend_email_verification(env: Environment, user: User) -> Result<Comma
210 match response.status() {
211 reqwest::StatusCode::OK => Ok(CommandResult {
212 spinner,
213 - symbol: "✅".to_owned(),
214 - msg: "Verification email sent!".to_owned(),
213 + symbol: succeed_symbol(),
214 + msg: succeed_message("Verification email sent!"),
215 }),
216 _ => {
217 let error = anyhow!("Failed to send verification email.");
@@ -240,8 +240,8 @@ async fn connect_github_account(env: Environment, auth: SmbAuthorization) -> Res
240 );
241 return Ok(CommandResult {
242 spinner,
243 - symbol: "✅".to_owned(),
244 - msg: "Doing nothing.".to_owned(),
243 + symbol: succeed_symbol(),
244 + msg: succeed_message("Doing nothing."),
245 });
246 }
247
@@ -264,8 +264,8 @@ async fn connect_github_account(env: Environment, auth: SmbAuthorization) -> Res
264 match response.status() {
265 reqwest::StatusCode::OK => Ok(CommandResult {
266 spinner,
267 - symbol: "✅".to_owned(),
268 - msg: "GitHub account linked!".to_owned(),
267 + symbol: succeed_symbol(),
268 + msg: succeed_message("GitHub account linked!"),
269 }),
270 _ => {
271 let error = anyhow!("Failed to link GitHub account.");
@@ -393,8 +393,8 @@ async fn send_reset_password(env: Environment, user: Option<User>) -> Result<Com
393 );
394 return Ok(CommandResult {
395 spinner,
396 - symbol: style("✔").green().to_string(),
397 - msg: "Doing nothing.".to_owned(),
396 + symbol: succeed_symbol(),
397 + msg: succeed_message("Doing nothing."),
398 });
399 }
400 resend_reset_password_instruction(env, user).await
@@ -407,10 +407,7 @@ async fn send_reset_password(env: Environment, user: Option<User>) -> Result<Com
407 async fn resend_reset_password_instruction(env: Environment, user: User) -> Result<CommandResult> {
408 let mut spinner = Spinner::new(
409 spinners::Spinners::SimpleDotsScrolling,
410 - style("Sending reset password instruction...")
411 - .green()
412 - .bold()
413 - .to_string(),
410 + succeed_message("Sending reset password instruction..."),
411 );
412 let response = Client::new()
413 .post(build_smb_resend_reset_password_instructions_url(env))