From 502a2ee331ab626a0532e4049f7ed564890493fd Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:13:27 +1200 Subject: [PATCH] Update formatting of generated headers (#94) --- scripts/make_header.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/scripts/make_header.sh b/scripts/make_header.sh index a916ae9..f2c33b6 100755 --- a/scripts/make_header.sh +++ b/scripts/make_header.sh @@ -2,13 +2,19 @@ cat <./$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 <>./$1/$2 #include "esphome/core/hal.h" -namespace esphome { +namespace esphome { namespace $3 { EOT @@ -18,8 +24,9 @@ cat <>./$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