aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-11 20:14:53 +0900
committernsfisis <nsfisis@gmail.com>2026-06-11 20:14:53 +0900
commit8b7abe99d8c351d6f0e83aca9e12bbb8c3ea8182 (patch)
tree80678d8c3babf71d8bb8265dac9016bb58c9eba1 /crates/shirabe/src
parent410858be0520a519531034fcd6c9331a30bc91d2 (diff)
downloadphp-shirabe-8b7abe99d8c351d6f0e83aca9e12bbb8c3ea8182.tar.gz
php-shirabe-8b7abe99d8c351d6f0e83aca9e12bbb8c3ea8182.tar.zst
php-shirabe-8b7abe99d8c351d6f0e83aca9e12bbb8c3ea8182.zip
refactor(argv): use std::env::args instead of server_argv shim
The server_argv() shim merely wrapped command-line arguments, so call std::env::args() directly at each use site and drop the unused shim.
Diffstat (limited to 'crates/shirabe/src')
-rw-r--r--crates/shirabe/src/factory.rs2
-rw-r--r--crates/shirabe/src/main.rs4
-rw-r--r--crates/shirabe/src/util/platform.rs10
3 files changed, 7 insertions, 9 deletions
diff --git a/crates/shirabe/src/factory.rs b/crates/shirabe/src/factory.rs
index 6d788f4..975c558 100644
--- a/crates/shirabe/src/factory.rs
+++ b/crates/shirabe/src/factory.rs
@@ -1328,7 +1328,7 @@ impl Factory {
static mut WARNED: bool = false;
let mut disable_tls = false;
// allow running the config command if disable-tls is in the arg list, even if openssl is missing, to allow disabling it via the config command
- let argv = shirabe_php_shim::server_argv();
+ let argv: Vec<String> = std::env::args().collect();
if !argv.is_empty()
&& argv.contains(&"disable-tls".to_string())
&& (argv.contains(&"conf".to_string()) || argv.contains(&"config".to_string()))
diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs
index 5c9dd9b..8ba695f 100644
--- a/crates/shirabe/src/main.rs
+++ b/crates/shirabe/src/main.rs
@@ -2,7 +2,7 @@
use shirabe::console::Application;
use shirabe::util::Platform;
-use shirabe_php_shim::{realpath, server_argv};
+use shirabe_php_shim::realpath;
fn main() {
// TODO(phase-c): the full initialization process in composer/bin/composer should be ported
@@ -10,7 +10,7 @@ fn main() {
Platform::put_env(
"COMPOSER_BINARY",
- &realpath(&server_argv()[0]).unwrap_or_default(),
+ &realpath(&std::env::args().next().unwrap_or_default()).unwrap_or_default(),
);
// run the command application
diff --git a/crates/shirabe/src/util/platform.rs b/crates/shirabe/src/util/platform.rs
index 08f5007..ecf2338 100644
--- a/crates/shirabe/src/util/platform.rs
+++ b/crates/shirabe/src/util/platform.rs
@@ -8,8 +8,8 @@ use shirabe_php_shim::{
PhpMixed, RuntimeException, defined, env_contains_key, env_get, env_set, env_unset,
file_exists, file_get_contents, fopen, fstat, function_exists, getcwd, getenv, in_array,
ini_get, is_array, is_readable, mb_strlen, php_os_family, posix_geteuid, posix_getpwuid,
- posix_getuid, posix_isatty, putenv, realpath, server_argv, server_contains_key, server_get,
- server_set, server_unset, stream_isatty, stripos, strlen, strtoupper, substr, usleep,
+ posix_getuid, posix_isatty, putenv, realpath, server_contains_key, server_get, server_set,
+ server_unset, stream_isatty, stripos, strlen, strtoupper, substr, usleep,
};
use crate::util::ProcessExecutor;
@@ -349,11 +349,9 @@ impl Platform {
false
}
- /// @return bool Whether the current command is for bash completion
+ /// Whether the current command is for bash completion
pub fn is_input_completion_process() -> bool {
- // PHP: $_SERVER['argv'][1] ?? null
- let argv = server_argv();
- argv.get(1).map(|s| s.as_str()) == Some("_complete")
+ std::env::args().nth(1).as_deref() == Some("_complete")
}
pub fn workaround_filesystem_issues() {