chore: improves feedback

This commit is contained in:
nuno maduro
2026-04-21 07:13:08 -07:00
parent a5915b16ab
commit 7e4280bf83
3 changed files with 24 additions and 64 deletions

View File

@ -69,10 +69,6 @@ final class BaselineSync
return false;
}
if (! $this->confirm($repo)) {
return false;
}
$this->output->writeln(sprintf(
' <fg=cyan>TIA</> fetching baseline from <fg=white>%s</>…',
$repo,
@ -337,41 +333,6 @@ final class BaselineSync
return null;
}
/**
* One-shot Y/n prompt. Defaults to Y. In non-interactive shells (CI,
* piped input) returns false so scripted runs never hang waiting for
* input.
*/
private function confirm(string $repo): bool
{
if (! $this->isTerminal()) {
return false;
}
$this->output->writeln('');
$this->output->writeln(sprintf(
' <fg=cyan>TIA</> no local cache — fetch baseline from <fg=white>%s</>? <fg=gray>[Y/n]</>',
$repo,
));
$handle = @fopen('php://stdin', 'r');
if ($handle === false) {
return false;
}
$line = fgets($handle);
fclose($handle);
if ($line === false) {
return false;
}
$line = strtolower(trim($line));
return $line === '' || $line === 'y' || $line === 'yes';
}
/**
* Real-TTY check for STDIN. Symfony's `isInteractive()` defaults to true
* unless `--no-interaction` is explicitly passed, which would make