summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2009-01-30 18:16:59 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:09:40 +0100
commit992a145afd7bec1b18d356909392d5c6bf20add5 (patch)
treef12b267da4f3ef366e18f0ca5ef9a8e6a7864e47
parente72f1790d493f19c186ae2b18f3c3665091d3039 (diff)
downloadvyos-live-build-992a145afd7bec1b18d356909392d5c6bf20add5.tar.gz
vyos-live-build-992a145afd7bec1b18d356909392d5c6bf20add5.zip
Automatically displaying manpage when calling a helper with -h or --help.
-rwxr-xr-xfunctions/arguments.sh2
-rwxr-xr-xfunctions/man.sh17
-rwxr-xr-xhelpers/lh2
3 files changed, 19 insertions, 2 deletions
diff --git a/functions/arguments.sh b/functions/arguments.sh
index b2e4c92d7..bbc439c84 100755
--- a/functions/arguments.sh
+++ b/functions/arguments.sh
@@ -43,7 +43,7 @@ Arguments ()
;;
-h|--help)
- Help
+ Man
shift
;;
diff --git a/functions/man.sh b/functions/man.sh
new file mode 100755
index 000000000..72213e2f8
--- /dev/null
+++ b/functions/man.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# man.sh - print man information
+# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org>
+#
+# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
+# This is free software, and you are welcome to redistribute it
+# under certain conditions; see COPYING for details.
+
+Man ()
+{
+ if [ -x "$(which man 2>/dev/null)" ]
+ then
+ man $(basename ${0})
+ exit 0
+ fi
+}
diff --git a/helpers/lh b/helpers/lh
index ca8397a64..7b27c2d56 100755
--- a/helpers/lh
+++ b/helpers/lh
@@ -31,7 +31,7 @@ USAGE="FIXME"
case "${1}" in
-h|--help)
- Help
+ Man
;;
-u|--usage)