yait

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a59730f4d49fed2e27f508a86be4d3ca0fb79753
parent 592301d1f8726dc070c43d32d5eaff7734ba0b28
Author: vx-clutch <[email protected]>
Date:   Thu, 21 Aug 2025 18:58:27 -0400

save

Diffstat:
MTODO | 1+
Mbin/yait | 0
Mconfig.mak | 2+-
Msrc/main.c | 29++++++++++++++---------------
Atools/Cleanup | 20++++++++++++++++++++
Mtools/format | 2+-
6 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/TODO b/TODO @@ -3,5 +3,6 @@ VX yait --- TODO Todo: * Argument Parsing + * Project creation end of file TODO diff --git a/bin/yait b/bin/yait Binary files differ. diff --git a/config.mak b/config.mak @@ -1,4 +1,4 @@ PREFIX=/usr/bin/ -CFLAGS=-ggdb -std=c23 +CFLAGS=-Wall -Wextra -O2 --std=c23 -Wpedantic LDFLAGS= CC=gcc diff --git a/src/main.c b/src/main.c @@ -8,9 +8,9 @@ // Usage: yait [OPTION]... <PROJECT> +#define _POSIX_C_SOURCE 200809L // popen extention #include <getopt.h> #include <pwd.h> -#define _POSIX_C_SOURCE 200809L // popen extention #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -21,35 +21,33 @@ #include "util.h" #define print_option(option, description) \ - fprintf(stderr, " %-20s %-20s\n", option, description) + printf(" %-20s %-20s\n", option, description) static void usage(int status) { if (status != 0) { - fputs("Try 'yait --help' for more information.\n", stderr); + puts("Try 'yait --help' for more information.\n"); return; } - fputs("Usage: yait [OPTION]... <PATH>", stderr); - fputs("Creates a C project with opinionated defaults.", stderr); - fputs("When only given the first argument it will detect your name.\n", - stderr); - fputs("Mandatory arguments to long options are mandatory for short options too", - stderr); + puts("Usage: yait [OPTION]... <PATH>"); + puts("Creates a C project with opinionated defaults"); + puts("When only given the first argument it will detect your name\n"); + puts("Mandatory arguments to long options are mandatory for short options too"); print_option("--posix", "Enable POSIX compliance"); print_option("--git", "Do not inititize git reposity"); print_option("--clang", "Add clang-format files and tooling"); print_option("-L <licence>", "Set licence"); print_option("-l <library>", "Add a library"); print_option("-C", "Use C++"); - print_option("--GNU", - "Add GNU argument parsing: --version, and --help"); + print_option("--GNU", "Add version and help parsing"); print_option("-S, --simple", "Enable simple mode"); - fputs(" --help display this help text and exit", stderr); - fputs(" --version output version information and exit", stderr); + puts(" --help display this help text and exit\n"); + puts(" --version output version information and exit\n"); } -static int parse_arguments(manifest_t *conf, int argc, char **argv) +[[maybe_unused]] static int parse_arguments(manifest_t *conf, int argc, + char **argv) { int opt; @@ -131,7 +129,8 @@ int main(int argc, char **argv) return fprintf(stderr, "error: %s\n", strerror(status)), EXIT_FAILURE; - parse_arguments(&manifest, argc, argv); + // parse_arguments(&manifest, argc, argv); + manifest.flags.simple = true; get_name(&manifest.name); status = create_project(manifest); diff --git a/tools/Cleanup b/tools/Cleanup @@ -0,0 +1,20 @@ +#!/bin/sh + +# Usage: ./Cleanup + +fatal() { + echo "$@" + echo fail. + exit 1 +} + +if [ ! -d "./tools" ]; then + echo "error: must be run from parent directory" + exit 1 +fi + +sh ./tools/format || fatal Could not run './tools/format' +rm -rf .cache || fatal Could not run 'rm -rf .cache' +make dist-clean || fatal Could not run 'make dist-clean' + +echo done. diff --git a/tools/format b/tools/format @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/sh # Usage ./format