summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-10-23 13:17:29 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-10-23 13:17:29 (EDT)
commitc5e8d0a37ba7d3b66e123d0105faa040cf4fe11b (patch)
tree0bbec5135012c494337163ac19d7b3c15348742a /lib
parent8b3d56c151552a12d5dec7ecd0928b423dd887f7 (diff)
help: New command.
Diffstat (limited to 'lib')
-rw-r--r--lib/cmd/help.sh40
-rw-r--r--lib/cmd/local.mk2
2 files changed, 41 insertions, 1 deletions
diff --git a/lib/cmd/help.sh b/lib/cmd/help.sh
new file mode 100644
index 0000000..6dbe84e
--- /dev/null
+++ b/lib/cmd/help.sh
@@ -0,0 +1,40 @@
+# ProteanOS Development Kit
+# lib/cmd/help.sh
+# "help" command
+#
+# Copyright (C) 2013 Patrick "P. J." McDermott
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+cmd_help_main()
+{
+ local cmd=
+
+ if [ ${#} -eq 1 ]; then
+ cmd="${1}"
+ if is_cmd "${cmd}"; then
+ print_cmd_usage "${cmd}"
+ return 0
+ fi
+ fi
+
+ printf "$(get_msg 'cmd_help_head')\n\n" "${0}"
+
+ printf "$(get_msg 'cmd_help_opts_head')\n"
+ print_opt_summaries
+ printf '\n'
+
+ printf "$(get_msg 'cmd_help_summary_head')\n"
+ print_cmd_summaries
+}
diff --git a/lib/cmd/local.mk b/lib/cmd/local.mk
index 360910c..fb2cbdb 100644
--- a/lib/cmd/local.mk
+++ b/lib/cmd/local.mk
@@ -1,2 +1,2 @@
pkgdatacmd_sources = \
-
+ lib/cmd/help.sh