Skip to content

Commit

Permalink
docs: add readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4k committed Sep 4, 2020
1 parent c4ffd1c commit 4dcb1c4
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 6 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@
[![CI Status](https://img.shields.io/github/workflow/status/denosaurs/tty/check)](https://github.com/denosaurs/tty/actions)
[![License](https://img.shields.io/github/license/denosaurs/tty)](https://github.com/denosaurs/tty/blob/master/LICENSE)

<p align="center">
<br>
<img src="assets/example.svg" width="200">
<br>
</p>


```typescript
import * as tty from "https://deno.land/x/tty/mod.ts";

await tty.hideCursor();

let i = 0;

setInterval(() => {
tty.clearScreenSync();
tty.goHomeSync();
console.log("HELLO WORLD");
console.log(i++);
}, 200);

await tty.showCursor();
```

## other
Expand Down
63 changes: 63 additions & 0 deletions assets/example.cast
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{"version": 2, "width": 80, "height": 25, "timestamp": 1599207122, "env": {"SHELL": "/bin/zsh", "TERM": "xterm-256color"}}
[0.275194, "o", "\u001b[?25l"]
[0.479588, "o", "\u001b[2J\u001b[H"]
[0.480159, "o", "\u001b[33m0\u001b[39m\r\n"]
[0.680346, "o", "\u001b[2J\u001b[H"]
[0.680682, "o", "\u001b[33m1\u001b[39m\r\n"]
[0.880856, "o", "\u001b[2J\u001b[H"]
[0.880985, "o", "\u001b[33m2\u001b[39m\r\n"]
[1.081979, "o", "\u001b[2J\u001b[H"]
[1.082102, "o", "\u001b[33m3\u001b[39m\r\n"]
[1.281013, "o", "\u001b[2J\u001b[H\u001b[33m4\u001b[39m\r\n"]
[1.477074, "o", "\u001b[2J\u001b[H\u001b[33m5\u001b[39m\r\n"]
[1.680431, "o", "\u001b[2J\u001b[H"]
[1.680738, "o", "\u001b[33m6\u001b[39m\r\n"]
[1.877312, "o", "\u001b[2J\u001b[H"]
[1.877705, "o", "\u001b[33m7\u001b[39m\r\n"]
[2.078558, "o", "\u001b[2J\u001b[H\u001b[33m8\u001b[39m\r\n"]
[2.280141, "o", "\u001b[2J\u001b[H\u001b[33m9\u001b[39m\r\n"]
[2.48092, "o", "\u001b[2J\u001b[H\u001b[33m10\u001b[39m\r\n"]
[2.680937, "o", "\u001b[2J\u001b[H"]
[2.68114, "o", "\u001b[33m11\u001b[39m\r\n"]
[2.880897, "o", "\u001b[2J\u001b[H\u001b[33m12\u001b[39m\r\n"]
[3.080272, "o", "\u001b[2J\u001b[H\u001b[33m13\u001b[39m\r\n"]
[3.277357, "o", "\u001b[2J\u001b[H\u001b[33m14\u001b[39m\r\n"]
[3.477, "o", "\u001b[2J\u001b[H\u001b[33m15\u001b[39m\r\n"]
[3.677682, "o", "\u001b[2J\u001b[H\u001b[33m16\u001b[39m\r\n"]
[3.879782, "o", "\u001b[2J\u001b[H\u001b[33m17\u001b[39m\r\n"]
[4.081486, "o", "\u001b[2J\u001b[H\u001b[33m18\u001b[39m\r\n"]
[4.281858, "o", "\u001b[2J\u001b[H\u001b[33m19\u001b[39m\r\n"]
[4.477014, "o", "\u001b[2J\u001b[H\u001b[33m20\u001b[39m\r\n"]
[4.680219, "o", "\u001b[2J\u001b[H\u001b[33m21\u001b[39m\r\n"]
[4.880865, "o", "\u001b[2J\u001b[H\u001b[33m22\u001b[39m\r\n"]
[5.079824, "o", "\u001b[2J\u001b[H\u001b[33m23\u001b[39m\r\n"]
[5.27926, "o", "\u001b[2J\u001b[H\u001b[33m24\u001b[39m\r\n"]
[5.478207, "o", "\u001b[2J\u001b[H\u001b[33m25\u001b[39m\r\n"]
[5.680405, "o", "\u001b[2J\u001b[H\u001b[33m26\u001b[39m\r\n"]
[5.87826, "o", "\u001b[2J\u001b[H\u001b[33m27\u001b[39m\r\n"]
[6.081833, "o", "\u001b[2J\u001b[H\u001b[33m28\u001b[39m\r\n"]
[6.280214, "o", "\u001b[2J\u001b[H\u001b[33m29\u001b[39m\r\n"]
[6.480205, "o", "\u001b[2J\u001b[H\u001b[33m30\u001b[39m\r\n"]
[6.676044, "o", "\u001b[2J\u001b[H\u001b[33m31\u001b[39m\r\n"]
[6.876783, "o", "\u001b[2J\u001b[H\u001b[33m32\u001b[39m\r\n"]
[7.080207, "o", "\u001b[2J\u001b[H\u001b[33m33\u001b[39m\r\n"]
[7.279711, "o", "\u001b[2J\u001b[H\u001b[33m34\u001b[39m\r\n"]
[7.481263, "o", "\u001b[2J\u001b[H\u001b[33m35\u001b[39m\r\n"]
[7.677003, "o", "\u001b[2J\u001b[H\u001b[33m36\u001b[39m\r\n"]
[7.88015, "o", "\u001b[2J\u001b[H"]
[7.880551, "o", "\u001b[33m37\u001b[39m\r\n"]
[8.08162, "o", "\u001b[2J\u001b[H\u001b[33m38\u001b[39m\r\n"]
[8.277013, "o", "\u001b[2J\u001b[H\u001b[33m39\u001b[39m\r\n"]
[8.47766, "o", "\u001b[2J\u001b[H\u001b[33m40\u001b[39m\r\n"]
[8.679479, "o", "\u001b[2J\u001b[H\u001b[33m41\u001b[39m\r\n"]
[8.881723, "o", "\u001b[2J\u001b[H"]
[8.882057, "o", "\u001b[33m42\u001b[39m\r\n"]
[9.081843, "o", "\u001b[2J\u001b[H\u001b[33m43\u001b[39m\r\n"]
[9.281814, "o", "\u001b[2J\u001b[H\u001b[33m44\u001b[39m\r\n"]
[9.481815, "o", "\u001b[2J\u001b[H\u001b[33m45\u001b[39m\r\n"]
[9.67697, "o", "\u001b[2J\u001b[H\u001b[33m46\u001b[39m\r\n"]
[9.879025, "o", "\u001b[2J\u001b[H\u001b[33m47\u001b[39m\r\n"]
[10.075867, "o", "\u001b[2J\u001b[H\u001b[33m48\u001b[39m\r\n"]
[10.280115, "o", "\u001b[2J\u001b[H\u001b[33m49\u001b[39m\r\n"]
[10.480051, "o", "\u001b[2J\u001b[H\u001b[33m50\u001b[39m\r\n"]
[10.680841, "o", "^C"]
1 change: 1 addition & 0 deletions assets/example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions examples/hello.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import * as tty from "../mod.ts";

await tty.hideCursor();

let i = 0;

setInterval(() => {
tty.clearScreenSync();
tty.goHomeSync();
console.log("HELLO WORLD");
console.log(i++);
}, 200);

await tty.showCursor();

0 comments on commit 4dcb1c4

Please sign in to comment.