(&self, scope: Scope<'_>)
| 142 | } |
| 143 | |
| 144 | async fn async_exec(&self, scope: Scope<'_>) -> CallResult<()> { |
| 145 | if self.service.borrow().is_logged_in() { |
| 146 | return Err(CallError::Precondition("Cannot LOGIN again before LOGOUT".to_owned())); |
| 147 | } |
| 148 | |
| 149 | let username = scope.get_string(0).to_owned(); |
| 150 | let password = if scope.nargs() == 1 { |
| 151 | read_line_secure(&mut *self.console.borrow_mut(), "Password: ") |
| 152 | .await |
| 153 | .map_err(CallError::from)? |
| 154 | } else { |
| 155 | debug_assert_eq!(2, scope.nargs()); |
| 156 | scope.get_string(1).to_owned() |
| 157 | }; |
| 158 | |
| 159 | self.do_login(&username, &password).await.map_err(CallError::from) |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /// The `LOGOUT` command. |
nothing calls this directly
no test coverage detected