diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-22 10:50:06 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-12-22 10:50:06 +1300 |
commit | 9267bccb6ae2f03f1eb8df7b3dd13d13ea57d14a (patch) | |
tree | de202e4865ae64c8fa2f958457738f0a5599684c | |
parent | Fix printf argument mismatch bugs (diff) | |
download | dotfiles-9267bccb6ae2f03f1eb8df7b3dd13d13ea57d14a.tar.gz dotfiles-9267bccb6ae2f03f1eb8df7b3dd13d13ea57d14a.zip |
Add vex(1df) and vest(1df)
-rw-r--r-- | README.markdown | 3 | ||||
-rwxr-xr-x | bin/vest | 2 | ||||
-rwxr-xr-x | bin/vex | 10 | ||||
-rw-r--r-- | man/man1/vest.1df | 19 | ||||
-rw-r--r-- | man/man1/vex.1df | 21 |
5 files changed, 55 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 49b4be1a..da88b2a9 100644 --- a/README.markdown +++ b/README.markdown @@ -491,6 +491,9 @@ Installed by the `install-bin` target: it finds a Makefile for which to run `make(1)` with the given arguments. * `uts(1df)` gets the current UNIX timestamp in an unorthodox way that should work on all POSIX-compliant operating systems. +* `vest(1df)` runs `test(1)` but fails with explicit output via `vex(1df)`. +* `vex(1df)` runs a command and prints `true` or `false` explicitly to + `stdout` based on the exit value. There's some silly stuff in `install-games`: diff --git a/bin/vest b/bin/vest new file mode 100755 index 00000000..db73e86d --- /dev/null +++ b/bin/vest @@ -0,0 +1,2 @@ +#!/bin/sh +vex test "$@" diff --git a/bin/vex b/bin/vex new file mode 100755 index 00000000..66c9590f --- /dev/null +++ b/bin/vex @@ -0,0 +1,10 @@ +#!/bin/sh +# Run a command and print a string to stdout showing pass/fail +"$@" +ex=$? +case $ex in + 0) op='true' ;; + *) op='false' ;; +esac +printf '%s\n' "$op" +exit "$ex" diff --git a/man/man1/vest.1df b/man/man1/vest.1df new file mode 100644 index 00000000..e94e6a82 --- /dev/null +++ b/man/man1/vest.1df @@ -0,0 +1,19 @@ +.TH VEST 1df "December 2016" "Manual page for vest" +.SH NAME +.B vest +\- run a test(1) command and print true/false to stdout for success/failure +.SH SYNOPSIS +.B vest +\-f /foo/bar/baz +.br +.B vest +\-s /etc/hostname +.SH DESCRIPTION +.B vest +wraps the test(1) command, but prints an explicit "true" or "false" to stdout +to show whether the test was true or false. It exits with the same value as the +test it ran. +.SH SEE ALSO +test(1), vex(1df) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/vex.1df b/man/man1/vex.1df new file mode 100644 index 00000000..e072bcb4 --- /dev/null +++ b/man/man1/vex.1df @@ -0,0 +1,21 @@ +.TH VEX 1df "December 2016" "Manual page for vex" +.SH NAME +.B vex +\- run a command and print true/false to stdout for success/failure +.SH SYNOPSIS +.B vex +true +.br +.B vex +test -f /foo/bar/baz +.SH DESCRIPTION +.B vex +runs the command given in its arguments, and prints "true" or "false" as the +last line of stdout based on the command's exit value. It does not interfere +with any output or error from the command itself. +.P +The exit value is the same as the command wrapped. +.SH SEE ALSO +vest(1df) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |