template files
This commit is contained in:
78
t/default/c.stpl
Normal file
78
t/default/c.stpl
Normal file
@@ -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 <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#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
|
||||||
12
t/default/ignore.stpl
Normal file
12
t/default/ignore.stpl
Normal file
@@ -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
|
||||||
64
t/default/makefile.stpl
Normal file
64
t/default/makefile.stpl
Normal file
@@ -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
|
||||||
48
t/default/readme.stpl
Normal file
48
t/default/readme.stpl
Normal file
@@ -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.
|
||||||
49
t/default/sh.stpl
Normal file
49
t/default/sh.stpl
Normal file
@@ -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]... <version> <dir>
|
||||||
|
{{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
|
||||||
Reference in New Issue
Block a user