Skip to content

Commit

Permalink
Update formatting of generated headers (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesserockz authored Apr 29, 2024
1 parent 7b00a2a commit 502a2ee
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions scripts/make_header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
cat <<EOT >./$1/$2
#pragma once
// Generated from https://github.com/esphome/esphome-webserver
$(if [ -n "$4" ]; then
echo "#ifdef USE_WEBSERVER_LOCAL"
echo "#if USE_WEBSERVER_VERSION == $4"
fi)
EOT

if [ -n "$4" ]; then
echo "#ifdef USE_WEBSERVER_LOCAL" >>./$1/$2
echo "#if USE_WEBSERVER_VERSION == $4" >>./$1/$2
echo "" >>./$1/$2
fi

cat <<EOT >>./$1/$2
#include "esphome/core/hal.h"
namespace esphome {
namespace esphome {
namespace $3 {
EOT
Expand All @@ -18,8 +24,9 @@ cat <<EOT >>./$1/$2
} // namespace $3
} // namespace esphome
$(if [ -n "$4" ]; then
echo "#endif"
echo "#endif"
fi)
EOT
if [ -n "$4" ]; then
echo "" >>./$1/$2
echo "#endif" >>./$1/$2
echo "#endif" >>./$1/$2
fi

0 comments on commit 502a2ee

Please sign in to comment.