~kennylevinsen/greetd

195a8111776b62f27731e43338ca83b8f9692004 — Hugo Osvaldo Barrera 1 year, 5 months ago 4b402a5
Use strip_prefix to strip prefix

No need to do it manually.
1 files changed, 3 insertions(+), 3 deletions(-)

M agreety/src/main.rs
M agreety/src/main.rs => agreety/src/main.rs +3 -3
@@ 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;