2 |
⌨️ typist
3 |
A stupid simple type test written in pure Bash v5.1+
4 |
5 |

6 |
7 |

8 |

9 |
10 | 
11 |
12 |
13 | ## Acquisition
14 | Download
15 |
16 | `git clone https://github.com/wick3dr0se/typist; cd typist`
17 |
18 |
19 | ## Execution
20 | `bash typist` or `./typist`
21 |
22 | ## Usage
23 | Type as fast as you can
24 |
25 | ## Controls
26 | - Q|q|Ctrl+C - Quit
27 | - R|r - Retry
28 |
--------------------------------------------------------------------------------
/phrases.txt:
--------------------------------------------------------------------------------
1 | The quick brown fox jumps over the lazy dog.
2 | Waltz, bad nymph, for quick jigs vex.
3 | Pack my box with five dozen liquor jugs.
4 | Mr. Jock, TV quiz PhD, bags few lynx.
5 | Two driven jocks help fax my big quiz.
6 | Sphinx of black quartz, judge my vow.
7 | The five boxing wizards jump quickly.
8 | How vexingly quick daft zebras jump!
9 | Jinxed wizards pluck ivy from the big quilt.
10 | Crazy Fredericka bought many very exquisite opal jewels.
11 | Quick wafting zephyrs vex bold Jim.
12 | Five or six big jet planes zoomed quickly by the new tower.
--------------------------------------------------------------------------------
/typist:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | init_term() {
4 | shopt -s checkwinsize; (:;:)
5 | ((startX=COLUMNS / 10 / 2 - ${#phrase} / 2))
6 | ((startY=LINES / 2))
7 | ((startX=startX < 0 ? 1 : startX + COLUMNS / 10))
8 |
9 | printf '\e[?1049h\e[2J\e[?25h\e[%d;%dH' "$startY" "$startX"
10 | }
11 |
12 | deinit_term() { printf '\e[?1049l\e[?25h'; }
13 |
14 | draw_phrase() {
15 | unset phrase phraseChars
16 |
17 | mapfile -t