开发者

How to get the Terminalsize with perl6/rakudo?

开发者 https://www.devze.com 2023-02-11 07:44 出处:网络
Is there for perl6 already something to get the Terminalsize? ( for example like the 开发者_JAVA百科perl5 \"Term::ReadKey::GetTerminalSize\" );I\'m not aware of a direct method, but parsing qx/resize

Is there for perl6 already something to get the Terminalsize?

( for example like the 开发者_JAVA百科perl5 "Term::ReadKey::GetTerminalSize" );


I'm not aware of a direct method, but parsing qx/resize/ should work on systems where the resize command is available.

Update: somewhat golfed parsing code:

my %h = qx/resize/.lines.grep(/\=/).map: { m/(\w+) \= (\d+) /; $/.list };
my ($y, $x) =  %h<LINES COLUMNS>;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号