Compare commits
9 Commits
b3a7d03fcd
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| cf5751840a | |||
| 5133045b31 | |||
| fc3d0a2e69 | |||
| 3073d4e88f | |||
| deca2349cf | |||
| a4f455deec | |||
| 12e838c0f0 | |||
| b54989f0ee | |||
| bbc8030dfb |
40
bin/yait
40
bin/yait
@@ -1,19 +1,17 @@
|
||||
#! /bin/sh
|
||||
# Highly opinionated C and SH project generator
|
||||
|
||||
scriptversion="0.0.1"
|
||||
scriptversion="0.3.1"
|
||||
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2025-2026 fSD
|
||||
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# Copyright (C) 2025-2026 fSD 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=$(basename "$0")
|
||||
version="$me\/fSD v$scriptversion
|
||||
version="$me/fSD v$scriptversion
|
||||
|
||||
Copyright (C) 2025-2026 fSD.
|
||||
This is free software; you are free to change and redistribute it.
|
||||
@@ -33,7 +31,7 @@ Options:
|
||||
-f overwrite existing files
|
||||
-a <author> set project author
|
||||
-r initialize Git repository for the project
|
||||
-q surpress output"
|
||||
-q suppress output"
|
||||
|
||||
x=c # language
|
||||
d="Does a thing" # package description
|
||||
@@ -55,6 +53,7 @@ lsay() {
|
||||
fi
|
||||
}
|
||||
|
||||
# main creation routine
|
||||
create_project() {
|
||||
name=$1
|
||||
|
||||
@@ -63,12 +62,19 @@ create_project() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# creates a shell project
|
||||
shell() {
|
||||
outfile="$name"
|
||||
|
||||
if [ -z "$S" ]; then
|
||||
mkdir "$name" || return
|
||||
cd "$name" || return
|
||||
if [ -d "$name" ]; then
|
||||
if ! [ -z "$f" ]; then
|
||||
rm -rf "$name"
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir "$name" || exit 1
|
||||
cd "$name" || exit 1
|
||||
|
||||
cat <<EOF > LICENSE
|
||||
ISC License
|
||||
@@ -132,7 +138,7 @@ This tool runs via the command \`$name\`.
|
||||
- \`$name -k\` -- Does option k
|
||||
EOF
|
||||
|
||||
mkdir bin || return
|
||||
mkdir bin || exit 1
|
||||
outfile="bin/$outfile"
|
||||
fi
|
||||
cat <<EOF > "$outfile"
|
||||
@@ -195,9 +201,15 @@ EOF
|
||||
chmod +x "$outfile"
|
||||
}
|
||||
|
||||
# creates a C project
|
||||
c() {
|
||||
mkdir "$name" || return
|
||||
cd "$name" || return
|
||||
if [ -d "$name" ]; then
|
||||
if ! [ -z "$f" ]; then
|
||||
rm -rf "$name"
|
||||
fi
|
||||
fi
|
||||
mkdir "$name" || exit 1
|
||||
cd "$name" || exit 1
|
||||
cat <<EOF > README
|
||||
$name
|
||||
$(echo "$name" | sed 's/./=/g')
|
||||
@@ -266,7 +278,7 @@ all: $name
|
||||
config.h:
|
||||
cp config.def.h \$@
|
||||
|
||||
dwm: \${OBJ}
|
||||
$name: \${OBJ}
|
||||
\${CC} -o \$@ \${OBJ} \${LDFLAGS}
|
||||
|
||||
clean:
|
||||
@@ -424,6 +436,10 @@ EOF
|
||||
*) c ;;
|
||||
esac
|
||||
|
||||
if ! [ -z "$r" ]; then
|
||||
git init -q || echo "$me: error: could not initilzie git repository" >&2
|
||||
fi
|
||||
|
||||
say "made $name at $(realpath "$name")"
|
||||
cd ..
|
||||
}
|
||||
|
||||
9
yait.1
9
yait.1
@@ -1,7 +1,7 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
|
||||
.TH YAIT "1" "January 2026" "yait v1" "User Commands"
|
||||
.TH FSD "1" "January 2026" "fSD v0.2.1" "User Commands"
|
||||
.SH NAME
|
||||
yait \- manual page for yait v1
|
||||
fSD \- manual page for fSD v0.2.1
|
||||
.SH SYNOPSIS
|
||||
.B yait
|
||||
[\fI\,OPTION\/\fR]... \fI\,<version> <dir>\/\fR
|
||||
@@ -17,6 +17,8 @@ output version information
|
||||
.TP
|
||||
\fB\-x\fR <language>
|
||||
set project type
|
||||
.HP
|
||||
\fB\-d\fR <description> set a description
|
||||
.TP
|
||||
\fB\-S\fR
|
||||
small project creation
|
||||
@@ -24,9 +26,6 @@ small project creation
|
||||
\fB\-f\fR
|
||||
overwrite existing files
|
||||
.TP
|
||||
\fB\-n\fR <name>
|
||||
set project name
|
||||
.TP
|
||||
\fB\-a\fR <author>
|
||||
set project author
|
||||
.TP
|
||||
|
||||
Reference in New Issue
Block a user