-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Labels
@Renji-FR
Description
I encountered an issue when my menu is bigger than my terminal:
phpclishell.mp4
Is it possible to print the console line number only for the menu?
I know I use stty binary to retrieve my terminal size:
<?php namespace Core\Console; class Tools { /** * @return false|array */ protected static function _getSize() { $sttyCommand = 'stty size'; exec($sttyCommand, $outputs, $status); if($status === 0 && count($outputs) >= 1) { if(preg_match('#^(?<rows>[0-9]+) (?<columns>[0-9]+)$#i', $outputs[0], $matches)) { return $matches; } } return false; } /** * @return false|int */ public static function getRows() { $consoleSize = static::_getSize(); return ($consoleSize !== false) ? ($consoleSize['rows']) : (false); } /** * @return false|int */ public static function getColumns() { $consoleSize = static::_getSize(); return ($consoleSize !== false) ? ($consoleSize['columns']) : (false); } }
Thank you