From a9bed6a2f92374981ecbac84bf496a3ee3a529fb Mon Sep 17 00:00:00 2001 From: SuperNovaa41 Date: Mon, 24 Feb 2025 11:28:48 -0500 Subject: [PATCH] Pushes files --- README.md | 6 +++++- install.sh | 9 +++++++++ run.sh | 29 +++++++++++++++++++++++++++++ templates/c/Makefile | 24 ++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100755 install.sh create mode 100755 run.sh create mode 100644 templates/c/Makefile diff --git a/README.md b/README.md index 9752fc9..bb8e4fe 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # tempc -Simple bash templating script \ No newline at end of file +Simple bash script that allows you to place pre-made templates for coding projects, as well as setting up a git instance in the folder. + +Made out of spite against a(n) ~~insane~~ friend that uses Nix. + +To add more templates, add a new folder in `~/.config/templates` diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..1e84596 --- /dev/null +++ b/install.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +mkdir -p $HOME/.config/templates/ +cp -r templates/* $HOME/.config/templates + +chmod +x run.sh + +sudo cp run.sh /usr/local/bin/tempc + diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..06a6647 --- /dev/null +++ b/run.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +list_templates() { + for dir in $HOME/.config/templates/*/ + do + dir=${dir%*/} + echo "${dir##*/}" + done +} + +if [[ -z "$1" ]]; then + echo "No template provided." + echo "Available templates:" + list_templates + exit +fi + +if [ ! -d "$HOME/.config/templates/$1" ]; then + echo "Template doesn't exist!" + echo "Available templates:" + list_templates + exit +else + cp -r $HOME/.config/templates/$1/* . + git init +fi + + + diff --git a/templates/c/Makefile b/templates/c/Makefile new file mode 100644 index 0000000..11a00a3 --- /dev/null +++ b/templates/c/Makefile @@ -0,0 +1,24 @@ +CC=gcc +CFLAGS= -c -g -Wall + +#LDLIBS = # -lcurl -lssl ... + +#TARGET := + +BUILD_DIR := ./build +SRC_DIRS := ./src + +SRCS := $(shell find $(SRC_DIRS) -name '*.c') + +OBJS := $(SRCS:%=$(BUILD_DIR)/%.o) + +$(BUILD_DIR)/$(TARGET): $(OBJS) + $(CC) $(OBJS) -o $@ $(LDLIBS) + +$(BUILD_DIR)/%.c.o: %.c + mkdir -p $(dir $@) + $(CC) $(CFLAGS) -c $< -o $@ + +.PHONY: clean +clean: + rm -rf $(BUILD_DIR)