Skip to content

Core\Cli

Works with the terminal in a command-line program. It gives the program's arguments and the terminal's size and colours, asks the user questions, and shows output that updates in place.

Members

15 members.

MemberSignature
argumentsarguments(): array<tainted string>
writewrite(string|Core\Cli\Text $value, { stream?: Core\Cli::Stream, newline?: bool }): void
escapeescape(string $text): string
isTtyisTty(Core\Cli::Stream $stream): bool
widthwidth(): uint
heightheight(): uint
colorDepthcolorDepth(): Core\Cli::ColorDepth
displayWidthdisplayWidth(string $value): uint
askask(string $question, { default?: string, validate?: callable }): tainted string
confirmconfirm(string $question, { default?: bool }): bool
selectselect(string $question, array<T> $choices, { labels?: callable, default?: T }): T
selectManyselectMany(string $question, array<T> $choices, { labels?: callable }): array<T>
askSecretaskSecret(string $question): secret tainted string
showLiveshowLive(callable(Core\Cli\Live): T $body): T
showProgressshowProgress(uint $total, callable(Core\Cli\Progress): T $body): T

Enums

  • StreamOne of the three standard streams a process starts with. Whether output goes to a terminal is always checked for one stream, not for the whole process.
  • ColorDepthHow much colour standard output can show. The cases are in increasing order, so you can compare two depths.