Initial commit
authorMatthew Owens <matthew@owens.tech>
Tue, 21 Dec 2021 20:44:05 +0000 (20:44 +0000)
committerMatthew Owens <matthew@owens.tech>
Tue, 21 Dec 2021 20:44:05 +0000 (20:44 +0000)
CMakeLists.txt [new file with mode: 0644]
README.md [new file with mode: 0644]
init_module.sh [new file with mode: 0755]
src/template.c [new file with mode: 0644]
src/template.h [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f7e5667
--- /dev/null
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.15)
+project(template)
+
+set(CMAKE_C_STANDARD 11)
+
+file(GLOB_RECURSE SRC
+       src/*.c
+       template-test/*.c
+)
+
+add_executable(template-test ${SRC})
+target_include_directories(template-test
+       PUBLIC src
+       PUBLIC template-test
+)
+
+target_link_libraries(template-test PRIVATE check)
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..c95f8c6
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# module-template
diff --git a/init_module.sh b/init_module.sh
new file mode 100755 (executable)
index 0000000..3f82dfa
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+function error()
+{
+       echo "provide a name"
+       exit 1
+}
+
+function init()
+{
+       echo "renaming template file & lines to $1"
+       upper=$(echo $1 | tr '[:lower:]' '[:upper:]')
+       under=$(echo $1 | tr '-' '_')
+       dashes=$(echo $1 | tr '_' '-')
+
+       mv src/template.h src/$under.h
+       mv src/template.c src/$under.c
+       find . -type f -name '*.[c|h]' -exec sed -i "s/template/$under/g" {} +
+       sed -i "s/template/$under/g" CMakeLists.txt
+       echo "build" > .gitignore
+
+       # clearing README
+       echo "# $dashes" > README.md
+}
+
+# do we have a name parameter?
+[ $# -eq 1 ] && init $1 || error
+rm -- "$0"
+
+# clearing up source control
+git rm src/template.c src/template.h $0
+git add src/ README.md .gitignore CMakeLists.txt
+
+git commit -m "replaced template strings with $1"
+git push
+
diff --git a/src/template.c b/src/template.c
new file mode 100644 (file)
index 0000000..a0c3cf6
--- /dev/null
@@ -0,0 +1 @@
+#include "template.h"
diff --git a/src/template.h b/src/template.h
new file mode 100644 (file)
index 0000000..6f70f09
--- /dev/null
@@ -0,0 +1 @@
+#pragma once