aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-11 19:32:14 +0900
committernsfisis <nsfisis@gmail.com>2026-06-11 19:32:14 +0900
commit86ed0a83afaafbaba0b6849ca3cae89961df956f (patch)
tree06937325beb95acb82ac15ca2e61853512178aa1
parent42d002a7090327fc8d805ad9426764e77dfbfe24 (diff)
downloadphp-shirabe-86ed0a83afaafbaba0b6849ca3cae89961df956f.tar.gz
php-shirabe-86ed0a83afaafbaba0b6849ca3cae89961df956f.tar.zst
php-shirabe-86ed0a83afaafbaba0b6849ca3cae89961df956f.zip
feat(bin): port composer entry point into main.rs
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
-rw-r--r--crates/shirabe/src/main.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs
index 0672e51..5c9dd9b 100644
--- a/crates/shirabe/src/main.rs
+++ b/crates/shirabe/src/main.rs
@@ -1,3 +1,25 @@
+//! ref: composer/bin/composer
+
+use shirabe::console::Application;
+use shirabe::util::Platform;
+use shirabe_php_shim::{realpath, server_argv};
+
fn main() {
- println!("Hello, World!");
+ // TODO(phase-c): 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",
+ &realpath(&server_argv()[0]).unwrap_or_default(),
+ );
+
+ // run the command application
+ let mut application = Application::new("Composer".to_string(), String::new());
+ match application.run(None, None) {
+ Ok(_) => {}
+ Err(e) => {
+ eprintln!("{}", e);
+ std::process::exit(1);
+ }
+ }
}