aboutsummaryrefslogtreecommitdiff
path: root/bin/han.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-11-12 10:34:39 +1300
committerTom Ryder <tom@sanctum.geek.nz>2020-11-12 10:34:39 +1300
commit8e5da0d052d44249c1a262b198d50d455a27785e (patch)
treee0ade9d639560549ece06e36501c5775ae18d1f3 /bin/han.bash
parentMerge branch 'release/v10.13.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-d78e1b69aab33438114ff697e4ce753b0ed9d975.tar.gz (sig)
dotfiles-d78e1b69aab33438114ff697e4ce753b0ed9d975.zip
Merge branch 'release/v10.14.0'v10.14.0
* release/v10.14.0: Simplify han(1df) to remove unneeded temp dir Rewrap comments in vimrc Update vim-redact-pass to v2.2.1
Diffstat (limited to 'bin/han.bash')
-rw-r--r--bin/han.bash22
1 files changed, 3 insertions, 19 deletions
diff --git a/bin/han.bash b/bin/han.bash
index 6ab0b3e7..2cac9d4e 100644
--- a/bin/han.bash
+++ b/bin/han.bash
@@ -13,22 +13,6 @@ if ((BASH_VERSINFO[0] >= 4)) ; then
helpopts=(-m)
fi
-# Create a temporary directory with name in $td, and a trap to remove it when
-# the script exits
-td=
-cleanup() {
- [[ -n $td ]] && rm -fr -- "$td"
-}
-trap cleanup EXIT
-td=$(mktd "$self") || exit
-
-# If we have exactly one argument and a call to the help builtin with that
-# argument succeeds, display its output with `pager -s`
-if (($# == 1)) &&
- help "${helpopts[@]}" "$1" >"$td"/"$1".help 2>/dev/null ; then
- (cd -- "$td" && "$PAGER" -s -- "$1".help)
-
-# Otherwise, just pass all the arguments to man(1)
-else
- man "$@"
-fi
+# Call `help`, with the `-m` flag if available; if it errors out (discard
+# stderr), run `man` instead
+help "${helpopts[@]}" -- "$@" 2>/dev/null || man -- "$@"