generate-cmdlist.sh 793 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. echo "/* Automatically generated by $0 */
  3. struct cmdname_help
  4. {
  5. char name[16];
  6. char help[80];
  7. };
  8. static struct cmdname_help common_cmds[] = {"
  9. sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
  10. sort |
  11. while read cmd
  12. do
  13. sed -n '
  14. /^NAME/,/perf-'"$cmd"'/H
  15. ${
  16. x
  17. s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
  18. p
  19. }' "Documentation/perf-$cmd.txt"
  20. done
  21. echo "#ifdef HAVE_LIBELF_SUPPORT"
  22. sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
  23. sort |
  24. while read cmd
  25. do
  26. sed -n '
  27. /^NAME/,/perf-'"$cmd"'/H
  28. ${
  29. x
  30. s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
  31. p
  32. }' "Documentation/perf-$cmd.txt"
  33. done
  34. echo "#endif /* HAVE_LIBELF_SUPPORT */"
  35. echo "};"