diff --git a/Makefile b/Makefile index 0696fe1..7379929 100644 --- a/Makefile +++ b/Makefile @@ -9,18 +9,21 @@ all: install: install -d $(DESTDIR)$(PREFIX)/bin install -d $(DESTDIR)$(PREFIX)/share/man/man1 + install -d $(DESTDIR)$(PREFIX)/share/tt install -m755 bin/tt $(DESTDIR)$(PREFIX)/bin install -m644 tt.1.gz $(DESTDIR)$(PREFIX)/share/man/man1 + cp -r themes words quotes $(DESTDIR)$(PREFIX)/share/tt .PHONY: uninstall uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/tt rm -f $(DESTDIR)$(PREFIX)/share/man/man1/tt.1.gz + rm -rf $(DESTDIR)$(PREFIX)/share/tt .PHONY: assets assets: python3 ./scripts/themegen.py - ./scripts/pack themes/ words/ quotes/ > src/packed.go + ./scripts/pack > src/packed.go pandoc -s -t man -o - man.md|gzip > tt.1.gz .PHONY: rel diff --git a/README.md b/README.md index 439ca6a..d1fd923 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,10 @@ other *nix tools. With a little shell scripting most features the user can conceive of should be possible to implement. Below are some simple examples of what can be achieved. - - `shuf -n 40 /usr/share/dict/words|tt` Produces a test consisting of 40 random words drawn from your system's dictionary. - - `curl http://api.quotable.io/random|jq '[.text=.content|.attribution=.author]'|tt -quotes -` Produces a test consisting of a random quote. + - `shuf -n 40 /usr/share/dict/words | tt` Produces a test consisting of 40 random words drawn from your system's dictionary. + - `curl http://api.quotable.io/random | jq -M '[.text=.content|.attribution=.author]'|tt -quotes -` Produces a test consisting of a random quote. - `alias ttd='tt -csv >> ~/wpm.csv'` Creates an alias called ttd which keeps a log of progress in your home directory`. + - `fortune matrix | tt -bold -blockcursor -showwpm -theme matrix -w "$[COLUMNS/2]"` Produces a test consisting of a random "The Matrix" quote. The default behaviour is equivalent to `tt -n 50`. @@ -79,7 +80,8 @@ See `-help` for an exhaustive list of options. ## Configuration -Custom themes and word lists can be defined in `~/.tt/themes` and `~/.tt/words` +Custom themes and word lists can be defined in `~/.config/tt/themes` and `~/.config/tt/words` and used in conjunction with the `-theme` and `-words` flags. A list of preloaded themes and word lists can be found in `words/` and `themes/` and are accessible by default using the respective flags. + diff --git a/man.md b/man.md index aa593ad..bf79f99 100644 --- a/man.md +++ b/man.md @@ -170,35 +170,41 @@ tt ~/war_and_peace.txt -start 1 Produces a test consisting of 40 random words draw from the system dictionary (similar to 'tt -n 40'). ``` -shuf -n 40 /usr/share/dict/words|tt +shuf -n 40 /usr/share/dict/words | tt ``` Starts a test consisting of two randomly drawn quotes from api.quotable.io and prints the output of each test to STDOUT in csv format. ``` -curl https://api.quotable.io/quotes|\ - jq '[.results[]|.text=.content|.attribution=.author][:2]'|\ - tt -quotes - -norreport -csv +curl -L api.quotable.io/quotes \ +| jq -M '[.results[]|.text=.content|.attribution=.author][:2]' \ +| tt -quotes - -norreport -csv +``` + +Starts a test consisting of a randomly drawn quote from "The Matrix" movies. +``` +fortune matrix | tt -bold -showwpm -theme matrix -w "$[COLUMNS/2]" ``` Starts a new typing test which uses the tt source as input: ``` -curl -LsS https://raw.githubusercontent.com/lemnos/tt/master/src/tt.go | head -n 20 | tt -noskip -raw +curl -L raw.githubusercontent.com/lemnos/tt/master/src/tt.go \ +| head -n 20 | tt -noskip -raw ``` -Modify to taste. - # PATHS Some options like **-words** and **-theme** accept a path. If the given path does not exist, the following directories are searched for a file with the given name before falling back to internal resources: - ~/.tt/words\ - ~/.tt/themes\ - /etc/tt/words\ - /etc/tt/themes + ~/.config/tt/words/\ + ~/.config/tt/themes/\ + /usr/local/tt/words/\ + /usr/local/tt/themes/\ + /etc/tt/words/\ + /etc/tt/themes/\ # KEYS @@ -206,7 +212,7 @@ Modify to taste. **C-c: ** Terminates tt\ **C-backspace: ** Deletes the previous word\ **right** Move to the next test.\ - **left** Move to the previous test. + **left** Move to the previous test.\ # AUTHOR @@ -215,9 +221,12 @@ Aetnaeus (aetnaeus@protonmail.com) # SEE ALSO ## Project Page + https://github.com/dardo82/tt + Originally forked from https://github.com/lemnos/tt # LICENSE MIT + diff --git a/scripts/pack b/scripts/pack index 9a1f3c2..cb2dea9 100755 --- a/scripts/pack +++ b/scripts/pack @@ -1,7 +1,5 @@ #!/bin/sh -[ $# -gt 0 ] || { echo "Usage: $0 ... > packed.go"; exit 1; } - cat <