Pushes files
This commit is contained in:
parent
7b08867028
commit
a9bed6a2f9
@ -1,3 +1,7 @@
|
||||
# tempc
|
||||
|
||||
Simple bash templating script
|
||||
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`
|
||||
|
9
install.sh
Executable file
9
install.sh
Executable file
@ -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
|
||||
|
29
run.sh
Executable file
29
run.sh
Executable file
@ -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
|
||||
|
||||
|
||||
|
24
templates/c/Makefile
Normal file
24
templates/c/Makefile
Normal file
@ -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)
|
Loading…
x
Reference in New Issue
Block a user