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.

44 lines
1.3 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/sde-help.in
  5. # Copyright (C) 2006 - 2007 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- SDE-COPYRIGHT-NOTE-END ---
  14. #Description: Help about the usage of `sde` and the modules
  15. #Alias: --help
  16. help_command() {
  17. if [ -r "$SDEROOT/lib/sde-$1.hlp" ]; then
  18. grep -v '^#' "$SDEROOT/lib/sde-$1.hlp"
  19. else
  20. echo_warning "'$COLOR_MESSAGE${1}$COLOR_NORMAL' doesn't provide help."
  21. fi
  22. }
  23. help_list() {
  24. local command=
  25. local name= desc= alias=
  26. echo "Available Commands:"
  27. for command in $SDEROOT/bin/sde-*; do
  28. # detect command name
  29. id=$( echo "$command" | sed -e 's,.*/sde-,,' )
  30. # optional description
  31. desc=$( sed -n -e 's,^#Description: \(.*\)$,\1,p' "$command" )
  32. # and valid aliases
  33. alias=$( sed -n -e 's,^#Alias: \([^ ]*\)$,\1,p' "$command" | tr '\n' ' ' )
  34. echo -e "\t* $id${alias:+\t(${alias%% })}"
  35. if [ -n "$desc" ]; then
  36. echo -e "\t\t$desc"
  37. fi
  38. done
  39. }