2 files changed
+13
-5
crates/cli/src/account/me/mod.rs
+12
-4
@@ -1,3 +1,4 @@
1
+use crate::account::lib::is_logged_in;
2
use crate::{
3
cli::CommandResult,
4
ui::{fail_message, fail_symbol, succeed_message, succeed_symbol},
@@ -35,6 +36,16 @@ fn show_user(user: &User) {
36
}
37
38
pub async fn process_me(env: Environment) -> Result<CommandResult> {
39
+ if !is_logged_in(env) {
40
+ return Ok(CommandResult {
41
+ spinner: Spinner::new(
42
+ spinners::Spinners::SimpleDotsScrolling,
43
+ succeed_message("Loading"),
44
+ ),
45
+ symbol: fail_symbol(),
46
+ msg: fail_message("You are not logged in. Please login first."),
47
+ });
48
+ }
49
let mut spinner = Spinner::new(
50
spinners::Spinners::SimpleDotsScrolling,
51
succeed_message("Loading"),
@@ -53,10 +64,7 @@ pub async fn process_me(env: Environment) -> Result<CommandResult> {
64
})
65
}
66
Err(e) => {
56
- spinner.stop_and_persist(
57
- &fail_symbol(),
58
- fail_message("Error while requesting your information."),
59
- );
67
+ spinner.stop_and_persist(&fail_symbol(), fail_message(&e.to_string()));
68
Err(e)
69
}
70
}
crates/smbcloud-networking/src/lib.rs
+1
-1
@@ -16,7 +16,7 @@ pub async fn get_smb_token(env: Environment) -> Result<String> {
16
anyhow!("Error while reading token. Are you logged in?")
17
})
18
} else {
19
- Err(anyhow!("Failed to get home directory."))
19
+ Err(anyhow!("Failed to get home directory. Are you logged in?"))
20
}
21
}
22