Use strip_prefix to strip prefix
No need to do it manually.
This commit is contained in:
parent
4b402a5753
commit
195a811177
|
@ -60,9 +60,9 @@ enum LoginResult {
|
|||
fn login(node: &str, cmd: &mut Option<String>) -> Result<LoginResult, Box<dyn std::error::Error>> {
|
||||
let username = loop {
|
||||
let username = prompt_stderr(&format!("{} login: ", node))?;
|
||||
if username.starts_with('!') {
|
||||
*cmd = Some(username[1..].to_string());
|
||||
eprintln!("Login command changed to: {}", &username[1..]);
|
||||
if let Some(u) = username.strip_prefix('!') {
|
||||
*cmd = Some(u.to_string());
|
||||
eprintln!("Login command changed to: {u}");
|
||||
continue;
|
||||
}
|
||||
break username;
|
||||
|
|
Loading…
Reference in New Issue