aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/main.rs
blob: 5c9dd9b9476707b5704cca7df54f40d313b6161b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! ref: composer/bin/composer

use shirabe::console::Application;
use shirabe::util::Platform;
use shirabe_php_shim::{realpath, server_argv};

fn main() {
    // 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);
        }
    }
}