diff options
| -rw-r--r-- | crates/shirabe/src/command/outdated_command.rs | 21 | ||||
| -rw-r--r-- | crates/shirabe/src/console/application.rs | 8 | ||||
| -rw-r--r-- | crates/shirabe/tests/cli.rs | 1 |
3 files changed, 25 insertions, 5 deletions
diff --git a/crates/shirabe/src/command/outdated_command.rs b/crates/shirabe/src/command/outdated_command.rs index 22dd120..16a4ac5 100644 --- a/crates/shirabe/src/command/outdated_command.rs +++ b/crates/shirabe/src/command/outdated_command.rs @@ -214,10 +214,23 @@ impl Command for OutdatedCommand { )?; let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(input)); - // TODO(phase-c): proxying to ShowCommand via Application::run needs the shared shirabe - // Application handle (deferred with the Application shared-ownership work and registration). - let _ = (input, output); - todo!("outdated command proxy run pending shared Application handle") + + let application = { + let application = self + .get_application() + .expect("a proxy command is always attached to its application"); + let application = application.borrow(); + application + .as_any() + .downcast_ref::<crate::console::application::Application>() + .expect("shirabe always installs its own Application") + .shared() + }; + + Ok( + crate::console::application::Application::run(&application, Some(input), Some(output))? + as i64, + ) } fn initialize( diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index 4f7754d..7fa6720 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -246,6 +246,14 @@ impl Application { Ok(application) } + /// Returns the shared handle to this application set up by `new_shared`. Proxy commands use it to + /// re-enter the run flow (PHP's `$this->getApplication()->run(...)`). + pub fn shared(&self) -> std::rc::Rc<std::cell::RefCell<Application>> { + self.me + .upgrade() + .expect("Application must be constructed through new_shared") + } + /// Registers the default commands on a shared application (PHP's lazy `init()`), executed once /// with no application borrow held so each `set_application` can borrow back safely. fn init_shared( diff --git a/crates/shirabe/tests/cli.rs b/crates/shirabe/tests/cli.rs index a267ff2..ba58d11 100644 --- a/crates/shirabe/tests/cli.rs +++ b/crates/shirabe/tests/cli.rs @@ -145,7 +145,6 @@ run_no_panic_tests! { run_init => "init", run_install => "install", run_licenses => "licenses", - #[ignore = "currently panics"] run_outdated => "outdated", run_prohibits => "prohibits", run_reinstall => "reinstall", |
