From adfa7c6b295521a6f8fdf4084993a80a8030e49b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 19 Jun 2026 23:00:38 +0900 Subject: test(command): add basic smoke tests --- crates/shirabe/src/lib.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'crates/shirabe/src/lib.rs') diff --git a/crates/shirabe/src/lib.rs b/crates/shirabe/src/lib.rs index 1e17b72..4bd52c2 100644 --- a/crates/shirabe/src/lib.rs +++ b/crates/shirabe/src/lib.rs @@ -24,3 +24,23 @@ pub mod repository; pub mod script; pub mod self_update; pub mod util; + +pub fn run(argv: Vec) -> anyhow::Result { + use crate::console::Application; + use crate::util::Platform; + use shirabe_external_packages::symfony::console::input::argv_input::ArgvInput; + use shirabe_external_packages::symfony::console::input::input_interface::InputInterface; + + // TODO(php-runtime): the full initialization process in composer/bin/composer should be ported + // somewhere else that communicates with the real PHP runtime. + Platform::put_env( + "COMPOSER_BINARY", + &shirabe_php_shim::realpath(argv.first().map(String::as_str).unwrap_or_default()) + .unwrap_or_default(), + ); + + let application = Application::new_shared("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) +} -- cgit v1.3.1