#!/bin/sh
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: bin/sde-help
|
|
# Copyright (C) 2006 - 2008 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# 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; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
#Description: Help about the usage of `sde` and the modules
|
|
#Alias: man
|
|
|
|
set -e
|
|
|
|
[ -n "$SDEROOT" ] ||
|
|
export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
|
|
|
|
. "$SDEROOT/lib/libsde.in"
|
|
. "$SDEROOT/lib/sde-wrapper-command.in"
|
|
|
|
help_usage() {
|
|
cat <<-EOT
|
|
Usage: sde help <command>
|
|
|
|
Available Commands:
|
|
$( sde_wrapper_command_help_list )
|
|
EOT
|
|
|
|
exit 1
|
|
}
|
|
|
|
help_command() {
|
|
if [ -r "$SDEROOT/doc/man/sde-$1.1" ]; then
|
|
man "$SDEROOT/doc/man/sde-$1.1"
|
|
else
|
|
echo_warning "'$COLOR_MESSAGE${1}$COLOR_NORMAL' doesn't provide help."
|
|
fi
|
|
}
|
|
|
|
if [ $# -eq 0 -o -z "$1" ]; then
|
|
help_usage
|
|
elif [ $# -gt 1 -o "$1" != "${1%-*}" ]; then
|
|
# only one argument, and don't accept subcommands
|
|
echo_error "Incorrect Syntax."
|
|
help_usage
|
|
else
|
|
# detect requested command
|
|
command="$( sde_wrapper_command "$1" )"
|
|
if [ -z "$command" ]; then
|
|
# unknown command
|
|
echo_error "Command '$COLOR_MESSAGE$1$COLOR_NORMAL' doesn't exist."
|
|
help_usage
|
|
exit 2
|
|
else
|
|
help_command "$command"
|
|
fi
|
|
fi
|