1
0
Fork 0
2022-untitled-game/code/tools/scripts/header_generator.sh

28 lines
431 B
Bash
Raw Permalink Normal View History

2022-08-02 16:35:50 +00:00
#!/usr/bin/env bash
output=$1
echo -e "#pragma once\n" > $output
for input in "${@:2}";
do
name=$(basename $input | sed -r 's/\./_/g')
contents="const char* ${name} = \""
while read -r line;
do
if [[ $line == *"#"* ]] || [[ $line == *"//"* ]];
then
contents="${contents}\\n$line\\n"
else
contents="${contents}$line"
fi
done < "$input"
echo "$contents\";" >> $output
echo >> $output
done
echo >> $output