tty: Deno.setRaw(rid, mode) to turn on/off raw mode (#3958)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2020-02-25 22:01:24 -08:00 committed by GitHub
parent e53064c4f2
commit 5946808f66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 429 additions and 49 deletions

View file

@ -30,16 +30,6 @@ declare namespace Deno {
export function runTests(opts?: RunTestsOptions): Promise<void>;
/** Check if running in terminal.
*
* console.log(Deno.isTTY().stdout);
*/
export function isTTY(): {
stdin: boolean;
stdout: boolean;
stderr: boolean;
};
/** Get the loadavg. Requires the `--allow-env` flag.
*
* console.log(Deno.loadavg());
@ -492,6 +482,7 @@ declare namespace Deno {
seekSync(offset: number, whence: SeekMode): void;
close(): void;
}
/** An instance of `File` for stdin. */
export const stdin: File;
/** An instance of `File` for stdout. */
@ -555,6 +546,20 @@ declare namespace Deno {
/** Read-write. Behaves like `x` and allows to read from file. */
| "x+";
// @url js/tty.d.ts
/** UNSTABLE: newly added API
*
* Check if a given resource is TTY
*/
export function isatty(rid: number): boolean;
/** UNSTABLE: newly added API
*
* Set TTY to be under raw mode or not.
*/
export function setRaw(rid: number, mode: boolean): void;
// @url js/buffer.d.ts
/** A Buffer is a variable-sized buffer of bytes with read() and write()