From 30d755929846e76f03d81e42ec351197eb99d922 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Sun, 8 Jan 2023 20:44:53 -0700 Subject: [PATCH] New: man-help script for --help programs --- bin/man_help.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/man_help.sh diff --git a/bin/man_help.sh b/bin/man_help.sh new file mode 100755 index 0000000..21cf0c6 --- /dev/null +++ b/bin/man_help.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# `man` for programs that only support --help instead of a manpage +# +print_help() { + cat < + +Examples: + $(basename $0) dust + $(basename $0) cargo +HELP +} + +declare -r pgm="$1" + +if command -v "$pgm" &>/dev/null; then + "$pgm" --help | nvim -R -c 'set syn=man' -- +else + echo "Error: No command `$pgm` found" + exit 1 +fi