From 1be39bd69f93f3d0d385fc462d94f6b0218950cd Mon Sep 17 00:00:00 2001 From: vx-clutch Date: Sun, 11 Jan 2026 19:29:59 -0500 Subject: [PATCH] template files --- t/default/c.stpl | 78 +++++++++++++++++++++++++++++++++++++++++ t/default/ignore.stpl | 12 +++++++ t/default/makefile.stpl | 64 +++++++++++++++++++++++++++++++++ t/default/readme.stpl | 48 +++++++++++++++++++++++++ t/default/sh.stpl | 49 ++++++++++++++++++++++++++ 5 files changed, 251 insertions(+) create mode 100644 t/default/c.stpl create mode 100644 t/default/ignore.stpl create mode 100644 t/default/makefile.stpl create mode 100644 t/default/readme.stpl create mode 100644 t/default/sh.stpl diff --git a/t/default/c.stpl b/t/default/c.stpl new file mode 100644 index 0000000..ecda0ae --- /dev/null +++ b/t/default/c.stpl @@ -0,0 +1,78 @@ +; C file template +; +; +; This is the default C file template for the yait project init tool. This file +; is auto-generated on install and can be modified to your hearts content. An +; original copy can be found at /etc/yait/ +; + +@def main +/* + * main.c + * + * {{PACKAGE}}/{{AUTHOR}} 0.0.1 + * + * Copying policy + * + * {{PACKAGE}} 0.0.1 can be copied and distributed freely for any + * non-commercial purposes. {{PACKAGE}} 0.0.1 can only be incorporated + * into commercial software with the permission of the current author. + * + * This file contains the main driving routine. + * + */ + +#include +#include +#include + +#include "version.h" +#include "estruct.h" + +void usage(int status) +{ + printf("Usage: %s REQUIRED POSITIONAL ARGUMENT\n", PROGRAM_NAME); + printf(" or: %s [options]\n\n", PROGRAM_NAME); + fputs(" --help display this help and exit\n", stdout); + fputs(" --version output version information and exit\n", stdout); + + exit(status); +} + +int main(int argc, char **argv) +{ + int carg; + + if (argc == 2) { + if (strcmp(argv[1], "--help") == 0) { + usage(EXIT_FAILURE); + } + if (strcmp(argv[1], "--version") == 0) { + version(); + exit(EXIT_SUCCESS); + } + } + + puts(MESSAGE); + + return 0; +} +@end + +@def header +#ifndef {{MODULE}}_H_ +#define {{MODULE}}_H_ + +#endif /* {{MODULE}}_H_ */ +@end + +@def impl +/* {{MODULE}}.c + * + * The routines in this file handle **things** + * + * written by {{AUTHOR}} + */ + +#include "{{MODULE}}.h" +@end diff --git a/t/default/ignore.stpl b/t/default/ignore.stpl new file mode 100644 index 0000000..d37d694 --- /dev/null +++ b/t/default/ignore.stpl @@ -0,0 +1,12 @@ +; Gitignore file template +; +; +; This is the default gitignore file template for the yait project init tool. This file +; is auto-generated on install and can be modified to your hearts content. An +; original copy can be found at /etc/yait/ +; +; This file is only included when the C project strucutre is used. +; + +{{PACKAGE}} +*.o diff --git a/t/default/makefile.stpl b/t/default/makefile.stpl new file mode 100644 index 0000000..6c7bc27 --- /dev/null +++ b/t/default/makefile.stpl @@ -0,0 +1,64 @@ +; Makefile file template +; +; +; This is the default Makefile file template for the yait project init tool. This file +; is auto-generated on install and can be modified to your hearts content. An +; original copy can be found at /etc/yait/ +; + +@def C +# Makefile for {{PACKAGE}} + +# Make the build silent by default +V = + +ifeq ($(strip $(V)),) + E = @echo + Q = @ +else + E = @\# + Q = +endif +export E Q + +PROGRAM = {{PACKAGE}} +TARBALL = $(PROGRAM).tar +SRC = $(wildcard *.c) +OBJ = $(SRC:.c=.o) +HDR = $(wildcard *.h) + +CC = gcc +WARNINGS = -Wall -Wstrict-prototypes +CFLAGS = -O2 $(WARNINGS) -g +DEFINES = +LIBS = +LDFLAGS = +BINDIR = /usr/bin +LIBDIR = /usr/lib + +$(PROGRAM): $(OBJ) $(HDR) + $(E) " LINK " $@ + $(Q) $(CC) $(LDFLAGS) $(DEFINES) -o $@ $(OBJ) $(LIBS) + +clean: + $(E) " CLEAN" + $(Q) rm -f $(PROGRAM) $(OBJ) + +install: $(PROGRAM) + cp $(PROGRAM) ${BINDIR} + +release: $(PROGRAM) + tar cvf $(TARBALL) $(SRC) $(HDR) Makefile README + +.c.o: + $(E) " CC " $@ + $(Q) $(CC) $(CFLAGS) $(DEFINES) -c $< -o $@ +@end + +@def sh +all: + @echo "nothing to do" + +install: + cp bin/{{PACKAGE}} /usr/local/bin +@end diff --git a/t/default/readme.stpl b/t/default/readme.stpl new file mode 100644 index 0000000..6b21e48 --- /dev/null +++ b/t/default/readme.stpl @@ -0,0 +1,48 @@ +; READMILE file template +; +; +; This is the default README file template for the yait project init tool. This +; file is auto-generated on install and can be modified to your hearts content. +; An original copy can be found at /etc/yait/ +; + +# {{PACKAGE}} + +https://example.com + +Tagline about your tool + +- Feature 1 +- Feature 2 + * sub point + +## Install + +#### Dependencies + +@def c +- `c compiler` - C compiler +@end + +@def sh +- `sh script` - A valid POSIX shell +@end + +**Note**: `tool` is used as a part of the build process. It does many things +such as runs, exists, and consisting of more than -1 bytes + +```bash +git clone https://example.com/git-tree +cd {{PACKAGE}} +@def c +make +@end +sudo make install +``` + +## Usage + +This tool runs via the command `{{PACKAGE}}`. + +- `{{PACKAGE}} --option1` -- Does a thing. +- `{{PACKAGE}} --option2` -- Does another thing. diff --git a/t/default/sh.stpl b/t/default/sh.stpl new file mode 100644 index 0000000..cf1271f --- /dev/null +++ b/t/default/sh.stpl @@ -0,0 +1,49 @@ +; SH file template +; +; +; This is the default SH file template for the yait project init tool. This file +; is auto-generated on install and can be modified to your hearts content. An +; original copy can be found at /etc/yait/ +; + +#! /bin/sh +# {{DESCRIPTION}} + +scriptversion="1" + +# +# +# Copyright (C) {{YEAR}} {{AUTHOR}} +# +# +# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +me=$0 +version="$me v$scriptversion + +Copyright (C) 2025-2026 vx-clutch. +This is free software; you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + +usage="\ +Usage: $me [OPTION]... +{{DESCRIPTION}} + +Options: + --help print this help and exit + --version output version information +" + +while [ $# -gt 0 ]; do + case $1 in + --help) echo "$usage"; exit 0 ;; + --version) echo "$version"; exit 0 ;; + -*) echo "$me: Unknown option '$1'." >&2; exit 1 ;; + *) break ;; + esac +done