diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-12 15:20:07 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2020-05-12 19:26:14 +1200 |
commit | 1a3ae549beac1445e1bb44a809f3245e67ed0dfd (patch) | |
tree | a41e9d07117a92e654d40922f5677cb170ef77c9 | |
parent | Merge branch 'hotfix/v8.35.1' into develop (diff) | |
download | dotfiles-1a3ae549beac1445e1bb44a809f3245e67ed0dfd.tar.gz dotfiles-1a3ae549beac1445e1bb44a809f3245e67ed0dfd.zip |
Add qat(1df), implementing an item from IDEAS.md
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | IDEAS.md | 2 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | bin/qat.sh | 12 | ||||
-rw-r--r-- | man/man1/qat.1df | 19 |
6 files changed, 34 insertions, 2 deletions
@@ -98,6 +98,7 @@ /bin/pst.sh /bin/pvi /bin/pwg +/bin/qat /bin/quo /bin/rep /bin/rfcf @@ -3,8 +3,6 @@ Ideas * A wrapper `ksw(1df)` (kill-switch) that traps `SIGINT` to kill a called program or loop immediately, rather than aborting a loop (is this possible?) -* A wrapper `sil(1df)` or `nec(1df)` to turn `stty -echo` off for the duration - of a paste? * I can probably share my `psql()` completions/shortcuts after sanitizing them a bit * Wouldn't be too hard to add some HTTP BASIC authentication to `ix(1df)` to @@ -179,6 +179,7 @@ BINS = bin/ap \ bin/pst \ bin/pvi \ bin/pwg \ + bin/qat \ bin/quo \ bin/rep \ bin/rfcf \ @@ -573,6 +573,7 @@ These scripts are installed by the `install-bin` target: [`plenv`](https://github.com/tokuhirom/plenv), filters out any modules in `~/.plenv/non-cpan-modules`, and updates them all. * `pwg(1df)` generates just one decent password with `pwgen(1)`. +* `qat(1df)` disables `stty echo` for the duration of a paste. * `rep(1df)` repeats a command a given number of times. * `rgl(1df)` is a very crude interactive `grep(1)` loop. * `shb(1df)` attempts to build shebang lines for scripts from the system paths. diff --git a/bin/qat.sh b/bin/qat.sh new file mode 100755 index 00000000..31f5e8dd --- /dev/null +++ b/bin/qat.sh @@ -0,0 +1,12 @@ +#!/bin/sh +restore() { + if [ -n "$stty" ] ; then + stty "$stty" + fi +} +trap restore EXIT +if [ -t 0 ] ; then + stty=$(stty -g) + stty -echo +fi +cat diff --git a/man/man1/qat.1df b/man/man1/qat.1df new file mode 100644 index 00000000..d7466b3a --- /dev/null +++ b/man/man1/qat.1df @@ -0,0 +1,19 @@ +.TH QAT 1df "May 2020" "Manual page for qat" +.SH NAME +.B qat +\- quiet cat for terminal pastes +.SH SYNOPSIS +.B qat +| wc -l +.br +.B qat +| grep pattern +.SH DESCRIPTION +.B qat +switches the echo feature for stty(1) off for the duration of a cat(1). You +can use this to paste stuff into a pipeline without the terminal echoing it +back at you. +.SH SEE ALSO +stty(1) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |