commit fbbcb22867c57f99b89b6318f0d63f353612db6c
parent 6837ee4f159c88c27e94753eeca06cd49b2e3156
Author: vx-clutch <[email protected]>
Date: Fri, 22 Aug 2025 08:45:36 -0400
feat: simple
Diffstat:
5 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/include/yait.h b/include/yait.h
@@ -45,7 +45,5 @@ typedef struct {
} manifest_t;
int create_project(manifest_t manifest);
-int mkdir_p(const char *path);
-int cfprintf(const char *path, const char *format, ...);
#endif // YAIT_H
diff --git a/src/create_project.c b/src/create_project.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include "../include/yait.h"
+#include "util.h"
#include "contents.h"
char buffer[BUFSIZ];
@@ -20,14 +21,20 @@ int create_project(manifest_t manifest)
chdir(manifest.project);
if (manifest.flags.simple) {
+ /* This only works if the source
+ files's root name is the same as the target on all of the Makefile becuase of how it checks for files. */
cfprintf(
"Makefile",
".POSIX:\nCC ::= gcc\nCFLAGS ::= -Wall --std=c23 -Wpedantic\n\nall: %s",
manifest.project);
+ fprintf(stderr, "Created files 1\r");
cfprintf("README", "%s", manifest.project);
+ fprintf(stderr, "Created files 2\r");
snprintf(buffer, BUFSIZ, "%s.c", manifest.project);
cfprintf(buffer, "");
+ fputs("Created files 3, done.\n", stderr);
+ /* We exit early because the simple flag is an overridding flag. */
return 0;
}
diff --git a/src/main.c b/src/main.c
@@ -13,6 +13,7 @@
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include <unistd.h>
@@ -135,5 +136,9 @@ int main(int argc, char **argv)
get_name(&manifest.name);
status = create_project(manifest);
+ char buffer[PATH_MAX];
+ getcwd(buffer, PATH_MAX);
+ fprintf(stderr, "Created %s at\n %s\n", manifest.project, buffer);
+
return EXIT_SUCCESS;
}
diff --git a/src/util.h b/src/util.h
@@ -5,14 +5,10 @@
licence_t TOlicence(const char *s);
-struct option {
- const char *name;
- int has_arg;
- int *flag;
- int val;
-};
-
int getopt_long(int argc, char *const argv[], const char *optstring,
const struct option *longopts, int *longindex);
+int mkdir_p(const char *path);
+int cfprintf(const char *path, const char *format, ...);
+
#endif
diff --git a/tools/format b/tools/format
@@ -1,6 +1,6 @@
-#!/usr/sh
+#!/bin/sh
# Usage ./format
-find . -name "*.c" -exec clang-format -i {} \;
-find . -name "*.h" -exec clang-format -i {} \;
+find . -name "*.c" -exec clang-format -i --verbose {} \;
+find . -name "*.h" -exec clang-format -i --verbose {} \;