From 5e5930545b937a4740b04326929edd563cf0e93d Mon Sep 17 00:00:00 2001 From: Cyborus Date: Thu, 18 Apr 2024 17:47:22 -0400 Subject: [PATCH] don't print url scheme in `fj user` --- src/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e6dc07a..fa3293e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use clap::{Parser, Subcommand}; -use eyre::{eyre, Context}; +use eyre::{eyre, Context, OptionExt}; use tokio::io::AsyncWriteExt; mod keys; @@ -48,7 +48,14 @@ async fn main() -> eyre::Result<()> { .host_url() .clone(); let name = keys.get_login(&url)?.username(); - eprintln!("currently signed in to {name}@{url}"); + let host = url + .host_str() + .ok_or_eyre("instance url does not have host")?; + if url.path() == "/" || url.path().is_empty() { + println!("currently signed in to {name}@{host}"); + } else { + println!("currently signed in to {name}@{host}{}", url.path()); + } } Command::Auth(subcommand) => subcommand.run(&mut keys).await?, Command::Release(subcommand) => subcommand.run(&mut keys, host_name).await?,