summaryrefslogtreecommitdiff
path: root/pbs-help
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-03-19 14:29:04 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-03-19 14:29:04 -0400
commit9eff1e08b3e580d1e2a998af0243e27c8370c14e (patch)
treeb8d5df160dbc49d166553b81094fd8310e676e3d /pbs-help
parent21b3a17b9b3e0ab21354b22b8b4017380d0a39ea (diff)
Add pbs and pbs-help, to have it work like git
Diffstat (limited to 'pbs-help')
-rwxr-xr-xpbs-help39
1 files changed, 39 insertions, 0 deletions
diff --git a/pbs-help b/pbs-help
new file mode 100755
index 0000000..60d4270
--- /dev/null
+++ b/pbs-help
@@ -0,0 +1,39 @@
+#!/bin/bash -euE
+
+. libremessages
+
+stem=pbs
+
+list_commands() {
+ find ${PATH//:/ } -type f -executable -name "$stem-*" \
+ -printf '%f\n' 2>/dev/null | sed "s/^${stem}-//;/--/d"
+}
+
+master_usage() {
+ echo "Usage: ${pbs_short:-${stem}} COMMAND [OPTIONS]"
+ echo
+ echo "Commands:"
+ list_commands | sed 's/^/ /'
+}
+
+help_usage() {
+ echo "Usage: ${pbs_short:-${stem}} help [OPTIONS] COMMAND"
+ echo "Shows the manual page for a command"
+ echo ''
+ echo 'Options:'
+ echo ' -h Show this message'
+}
+
+main() {
+ if [[ $# < 1 ]]; then
+ master_usage
+ else
+ if in_array '-h' "$@"; then
+ help_usage
+ else
+ man "$stem-$1"
+ fi
+ fi
+}
+
+main "$@"