]> git.rmz.io Git - dotfiles.git/commitdiff
bin: generate date in mkcomponent
authorSamir Benmendil <me@rmz.io>
Tue, 12 Mar 2024 12:26:57 +0000 (12:26 +0000)
committerSamir Benmendil <me@rmz.io>
Tue, 12 Mar 2024 12:33:57 +0000 (12:33 +0000)
bin/mkcomponent

index 9f3a83394ef3e3c902beaa349aead1fa6af912a2..bca74688380b7377efec97ee6985255d3c5e7290 100755 (executable)
@@ -2,7 +2,7 @@
 
 version="0.1"
 
-function usage ()
+function usage()
 {
     echo "Usage :  $0 [options]
 
@@ -21,7 +21,7 @@ while [[ $# -gt 0 ]]; do
     case $opt in
         -h|--help)     usage; exit 0 ;;
         -v|--version)  echo "$0 -- Version $version"; exit 0 ;;
-        -* )
+        -*)
             echo -e "\n  Option does not exist : $opt\n"
             usage; exit 1 ;;
 
@@ -30,7 +30,7 @@ while [[ $# -gt 0 ]]; do
 done
 
 read -d '' fpp_copy <<EOD
-// Copyright © Focal Point Positioning Limited 2022. All Rights Reserved.
+// Copyright © Focal Point Positioning Limited $(date +%Y). All Rights Reserved.
 // This code is the copyright of Focal Point Positioning Limited and
 // cannot be used, copied or distributed without the express written
 // permission of Focal Point Positioning Limited.
@@ -42,7 +42,7 @@ _t=${COMPONENT_TEST_SUFFIX:-.t.cpp}
 
 for f in "${args[@]}"; do
     c=$(basename $f)
-    printf '%s\n\n#pragma once\n\n' "$fpp_copy" > $f$_h
-    printf '%s\n\n#include "%s"\n\n' "$fpp_copy" "$c$_h" > $f$_c
-    printf '%s\n\n#include <gtest/gtest.h>\n\n#include "%s"\n' "$fpp_copy" "$c$_h" > $f$_t
+    printf '%s\n\n#pragma once\n\n' "$fpp_copy" >$f$_h
+    printf '%s\n\n#include "%s"\n\n' "$fpp_copy" "$c$_h" >$f$_c
+    printf '%s\n\n#include <gtest/gtest.h>\n\n#include "%s"\n' "$fpp_copy" "$c$_h" >$f$_t
 done