Added build files to turn the bible into a book

This commit is contained in:
Dylan Araps
2018-06-20 12:40:31 +10:00
parent e0aadbde13
commit fe6e2cd195
21 changed files with 1310 additions and 1440 deletions

View File

@@ -1,42 +1,13 @@
# Traps
# Performance
Traps allow you to execute code on various signals. In `pxltrm` I'm using traps to redraw the user interface on window resize. Another use case is cleaning up temporary files on script exit.
## Disable Unicode
These `trap` lines should be added near the start of your script so any early errors are also caught.
**NOTE:** For a full list of signals, see `trap -l`.
## Do something on script exit
If your script doesn't require unicode, you can disable it for a speed boost. Results may vary but I've seen an improvement in Neofetch and some other smaller programs.
```shell
# Clear screen on script exit.
trap 'printf \\e[2J\\e[H\\e[m' EXIT
```
## Ignore terminal interrupt (CTRL+C, SIGINT)
```shell
trap '' INT
```
## React to window resize.
```shell
# Call a function on window resize.
trap 'code_here' SIGWINCH
```
## Do something before every command.
```shell
trap 'code_here' DEBUG
```
## Do something when a shell function or a sourced file finishes executing
```shell
trap 'code_here' RETURN
# Disable unicode.
LC_ALL=C
LANG=C
```
<!-- CHAPTER END -->