From ffd3e239a56172d2a336fb4d6253c01f6b1a0100 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 22 Jun 2026 04:38:26 +0900 Subject: refactor(console): introduce ApplicationHandle shared-ownership newtype Collapse the dual Application API (static methods taking `&Rc>` plus `&mut self` bridges via `shared()`) into a single handle type `ApplicationHandle(Rc>)`, mirroring the Composer handle pattern. Methods that invoke command callbacks (add, run, do_run, base_run, base_do_run, do_run_command, add_commands, init) move to `impl ApplicationHandle` with short-scoped borrows; data-only methods and `impl BaseApplication` stay on `Application`. `shared()` now returns the handle, and `new_shared`/`init_shared` fold into `ApplicationHandle::new`/`init`. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/lib.rs') diff --git a/crates/shirabe/src/lib.rs b/crates/shirabe/src/lib.rs index 8d8cc96..ec63ee1 100644 --- a/crates/shirabe/src/lib.rs +++ b/crates/shirabe/src/lib.rs @@ -26,7 +26,7 @@ pub mod self_update; pub mod util; pub fn run(argv: Vec) -> anyhow::Result { - use crate::console::Application; + use crate::console::ApplicationHandle; use crate::util::Platform; use shirabe_external_packages::symfony::console::input::argv_input::ArgvInput; use shirabe_external_packages::symfony::console::input::input_interface::InputInterface; @@ -39,10 +39,10 @@ pub fn run(argv: Vec) -> anyhow::Result { .unwrap_or_default(), ); - let application = Application::new_shared("Composer".to_string(), String::new())?; + let application = ApplicationHandle::new("Composer".to_string(), String::new())?; let input = std::rc::Rc::new(std::cell::RefCell::new(ArgvInput::new(Some(argv), None)?)) as std::rc::Rc>; - Application::run(&application, Some(input), None) + application.run(Some(input), None) } #[cfg(test)] -- cgit v1.3.1