diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-19 23:00:38 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-19 23:00:38 +0900 |
| commit | adfa7c6b295521a6f8fdf4084993a80a8030e49b (patch) | |
| tree | 36d2bc1f717286d129bc7f15fba2d06e6887ad5f /crates/shirabe/src/lib.rs | |
| parent | fd733a87364b877d5e66b4973bd61b5379ec4d61 (diff) | |
| download | php-shirabe-adfa7c6b295521a6f8fdf4084993a80a8030e49b.tar.gz php-shirabe-adfa7c6b295521a6f8fdf4084993a80a8030e49b.tar.zst php-shirabe-adfa7c6b295521a6f8fdf4084993a80a8030e49b.zip | |
test(command): add basic smoke tests
Diffstat (limited to 'crates/shirabe/src/lib.rs')
| -rw-r--r-- | crates/shirabe/src/lib.rs | 20 |
1 files changed, 20 insertions, 0 deletions
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<String>) -> anyhow::Result<i32> { + 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<std::cell::RefCell<dyn InputInterface>>; + Application::run(&application, Some(input), None) +} |
