From f411daceacad66e0bd774fda7d3c5ef8533cc55c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 26 May 2026 20:04:02 +0900 Subject: refactor(io): share IOInterface via Rc> handle Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/util/auth_helper.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/util/auth_helper.rs') diff --git a/crates/shirabe/src/util/auth_helper.rs b/crates/shirabe/src/util/auth_helper.rs index 908839e..3471a54 100644 --- a/crates/shirabe/src/util/auth_helper.rs +++ b/crates/shirabe/src/util/auth_helper.rs @@ -13,13 +13,14 @@ use shirabe_php_shim::{ use crate::config::Config; use crate::downloader::TransportException; use crate::io::IOInterface; +use crate::io::IOInterfaceImmutable; use crate::util::Bitbucket; use crate::util::GitHub; use crate::util::GitLab; #[derive(Debug)] pub struct AuthHelper { - pub(crate) io: Box, + pub(crate) io: std::rc::Rc>, pub(crate) config: std::rc::Rc>, /// @var array Map of origins to message displayed displayed_origin_authentications: IndexMap, @@ -41,7 +42,10 @@ pub enum StoreAuth { } impl AuthHelper { - pub fn new(io: Box, config: std::rc::Rc>) -> Self { + pub fn new( + io: std::rc::Rc>, + config: std::rc::Rc>, + ) -> Self { Self { io, config, @@ -339,7 +343,7 @@ impl AuthHelper { let access_token = bitbucket_util.request_token(&origin, &username, &password)?; if !access_token.is_empty() { - self.io.set_authentication( + self.io.borrow_mut().set_authentication( origin.clone(), "x-token-auth".to_string(), Some(access_token), @@ -452,7 +456,7 @@ impl AuthHelper { ); let username = self.io.ask(" Username: ".to_string(), PhpMixed::Null); let password = self.io.ask_and_hide_answer(" Password: ".to_string()); - self.io.set_authentication( + self.io.borrow_mut().set_authentication( origin.to_string(), username.as_string().unwrap_or("").to_string(), password, -- cgit v1.3.1