Skip to content

Commit 7f9cc50

Browse files
committed
feat: refactor command handling to use monlib method for login and logout operations
1 parent d5f3261 commit 7f9cc50

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/scimon.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ impl Scimon {
4545
Ok(())
4646
}
4747

48+
fn monlib(&self, options: &str) -> Result<(), Box<dyn Error>> {
49+
match options {
50+
"login" => println!("monlib login"),
51+
"logout" => MonlibLogout.logout(),
52+
_ => (),
53+
};
54+
55+
Ok(())
56+
}
57+
4858
pub async fn init(&self) {
4959
let (print, force_mode) = (false, false);
5060

@@ -90,11 +100,7 @@ impl Scimon {
90100
},
91101

92102
Commands::Auth { option } => {
93-
match option.as_str() {
94-
"login" => println!("monlib login"),
95-
"logout" => MonlibLogout.logout(),
96-
_ => (),
97-
};
103+
let _ = self.monlib(&option);
98104
},
99105
}
100106
}

0 commit comments

Comments
 (0)