From 2e18e2f669e30e01b1496c2557639b1c3c79cc06 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 20 Nov 2021 19:57:33 -0700 Subject: [PATCH] feature: detect MANPATh and install there --- scripts/install-man-page.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/install-man-page.sh b/scripts/install-man-page.sh index 499d0ef..b1cc922 100755 --- a/scripts/install-man-page.sh +++ b/scripts/install-man-page.sh @@ -1,3 +1,14 @@ #!/bin/sh -cp yq.1 /usr/local/share/man/man1/. \ No newline at end of file +my_path="$(command -v yq)" + +if [ -z "$my_path" ]; then + echo 'yq' wasn't found in your PATH, so we don't know where to put the man pages. + echo Please update your PATH and try again. + exit 1 +fi + +# ex: ~/.local/bin/yq => ~/.local/ +my_prefix="$(dirname "$(dirname "$(command -v yq)")")" +mkdir -p "$my_prefix/share/man/man1/" +cp yq.1 "$my_prefix/share/man/man1/"