diff --git a/TODO b/TODO index d5bf250..57b420e 100644 --- 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 index 17b3c13..9012716 100755 Binary files a/bin/yait and b/bin/yait differ diff --git a/config.mak b/config.mak index 09c76f2..d42c675 100644 --- 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 index d596ec9..1e557b3 100644 --- a/src/main.c +++ b/src/main.c @@ -8,9 +8,9 @@ // Usage: yait [OPTION]... +#define _POSIX_C_SOURCE 200809L // popen extention #include #include -#define _POSIX_C_SOURCE 200809L // popen extention #include #include #include @@ -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]... ", 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]... "); + 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 ", "Set licence"); print_option("-l ", "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 new file mode 100755 index 0000000..89ff69b --- /dev/null +++ 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 index 15ad8f5..34a70fc 100755 --- a/tools/format +++ b/tools/format @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/sh # Usage ./format