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