zupdate/generate_commands.sh
zawz 52a35fe7d1 + Add package regex match
+ Add target all option
* Restructure commands
2020-08-11 16:27:39 +02:00

18 lines
336 B
Bash
Executable file

#!/bin/sh
cd "$(dirname "$0")"
file=include/commands_gen.h
echo "#ifndef COMMANDS_GEN_H
#define COMMANDS_GEN_H
" > "$file"
for I in $(find commands -type f)
do
name=$(basename "$I" | tr '[:lower:]' '[:upper:]')_COMMAND
printf '#define %s "%s"\n' "$name" "$(sed '/^#/d' "$I" | tocstr)" >> "$file"
done
echo "
#endif" >> "$file"