diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-09 06:25:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-09 06:25:03 +0900 |
| commit | 6dd09abb33d86e1aa737667f9e15a18ed41d52e1 (patch) | |
| tree | 83f961fb8657c3b5c8440caecaf61a52fdc3a2de /crates/shirabe-external-packages/src/symfony/console/style | |
| parent | 880a5eaad9dcdfd31563385f11ba1f63d38cfd14 (diff) | |
| download | php-shirabe-6dd09abb33d86e1aa737667f9e15a18ed41d52e1.tar.gz php-shirabe-6dd09abb33d86e1aa737667f9e15a18ed41d52e1.tar.zst php-shirabe-6dd09abb33d86e1aa737667f9e15a18ed41d52e1.zip | |
refactor(external-packages): test for Windows with cfg!(windows)
MAIN_SEPARATOR is the path separator; PHP's `'\\' === DIRECTORY_SEPARATOR`
uses it as an OS test only because PHP has no dedicated one. cfg!(windows)
says what the branch actually selects on, and leaves MAIN_SEPARATOR to the
sites that really join or split paths.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/style')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs index e0994e99..8ae4d885 100644 --- a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs +++ b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs @@ -56,11 +56,7 @@ impl SymfonyStyle { output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, ) -> Self { let buffered_output = TrimmedBufferOutput::new( - if std::path::MAIN_SEPARATOR == '\\' { - 4 - } else { - 2 - }, + if cfg!(windows) { 4 } else { 2 }, Some(output.borrow().get_verbosity()), false, // TODO(plugin): clone of the formatter; PHP `clone $output->getFormatter()`. @@ -72,10 +68,7 @@ impl SymfonyStyle { let w = Terminal::new().get_width(); if w != 0 { w } else { MAX_LINE_LENGTH } }; - let line_length = std::cmp::min( - width - (std::path::MAIN_SEPARATOR == '\\') as i64, - MAX_LINE_LENGTH, - ); + let line_length = std::cmp::min(width - cfg!(windows) as i64, MAX_LINE_LENGTH); let inner = OutputStyle::new(output.clone()); @@ -279,7 +272,7 @@ impl SymfonyStyle { pub fn create_progress_bar(&self, max: i64) -> ProgressBar { let mut progress_bar = self.inner.create_progress_bar(max); - if std::path::MAIN_SEPARATOR != '\\' + if !cfg!(windows) || shirabe_php_shim::getenv("TERM_PROGRAM").as_deref() == Some(std::ffi::OsStr::new("Hyper")) { |
