OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: bin/sde-help
  6. # Copyright (C) 2006 - 2007 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. #Description: Help about the usage of `sde` and the modules
  16. #Alias: --help
  17. set -e
  18. [ -n "$SDEROOT" ] ||
  19. export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
  20. . $SDEROOT/lib/libsde.in
  21. . $SDEROOT/lib/sde-help.in
  22. if [ $# -eq 0 -o -z "$1" ]; then
  23. help_list
  24. elif [ $# -gt 1 ]; then
  25. echo_error "Incorrect Syntax."
  26. help_command 'help'
  27. exit 1
  28. elif [ -x "$SDEROOT/bin/sde-$1" ]; then
  29. help_command "$1"
  30. elif grep -q "^#Alias: $1$" $SDEROOT/bin/sde-* 2> /dev/null; then
  31. # use alias
  32. x="$( grep -l "^#Alias: $1$" $SDEROOT/bin/sde-* 2> /dev/null |
  33. head -n 1 | sed -e 's,.*/sde-,,' )"
  34. help_command "$x"
  35. else
  36. # unknown command
  37. echo_error "Command '$COLOR_MESSAGE$1$COLOR_NORMAL' doesn't exist."
  38. help_list
  39. exit 2
  40. fi