Author:ptrace
Comitter:ptrace
Date:2026-01-08 00:42:27 UTC
diff --git a/README.md b/README.md
index 5cc8f5c..776de2e 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ This program creates files and directories based on templates for Jai developmen
## Build / Install
```plain
$ jai -version
Version: beta 0.2.020, built on 27 November 2025.
Version: beta 0.2.024, built on 31 December 2025.
```
```plain
diff --git a/src/main.jai b/src/main.jai
index bef7595..6cdf3f7 100644
--- a/src/main.jai
+++ b/src/main.jai
@@ -24,7 +24,7 @@
*/
/*
+Version: 2.1.1
+Version: 2.2.1
*/
#import "Basic";
@@ -48,6 +48,7 @@ Rules :: struct {
template: string;
dirs_in_workplace: []string;
files: []File_Entity;
build_file_name: string = BUILD_FN;
}
File_Entity :: struct {
@@ -56,8 +57,8 @@ File_Entity :: struct {
}
Arguments :: struct {
g: bool; @"?If provided, no SCM repository will be created"
l: bool; @"?List available template types"
g: bool; @"?If provided, no SCM repository will be created"
l: bool; @"?List available template types"
t: string; @"?Pass a template type"
r: string; @"?Replace the replace marker with a given string"
}
@@ -107,7 +108,7 @@ create_directories :: (root_fp: string, rules: Rules) {
create_file :: (fp: string, content: string = "") {
#if DRY_RUN {
log_dry(tprint("file_write: % -> content: %", fp, content));
log_dry(tprint("file_write: % -> content:\n%", fp, content));
return;
}
@@ -128,7 +129,7 @@ create_files :: (root_fp: string, rules: Rules) {
create_file(fp, it.content);
}
build_template_fp := tprint("%/%", root_fp, BUILD_FN);
build_template_fp := tprint("%/%", root_fp, rules.build_file_name);
create_file(build_template_fp, rules.template);
}
diff --git a/templates/minimal/rules_minimal.jai b/templates/minimal/rules_minimal.jai
index 04825b7..2a014f4 100644
--- a/templates/minimal/rules_minimal.jai
+++ b/templates/minimal/rules_minimal.jai
@@ -60,5 +60,9 @@ main :: () {
.{ "src/main.jai", main_jai },
.{ "README.md", "" },
],
// You could specify the exact file name for the build file here.
// But you can also omit it and it will fall back to the default name.
//build_file_name = "build.jai",
};
}();
diff --git a/templates/script/rules_script.jai b/templates/script/rules_script.jai
new file mode 100644
index 0000000..dec14b0
--- /dev/null
+++ b/templates/script/rules_script.jai
@@ -0,0 +1,10 @@
() -> Rules {
return .{
arg_name = "scr",
description = "Use Jai like a script",
template = "templates/script/template.jai",
dirs_in_workplace = .[],
files = .[],
build_file_name = "main.jai",
};
}();
diff --git a/templates/script/template.jai b/templates/script/template.jai
new file mode 100644
index 0000000..b32d328
--- /dev/null
+++ b/templates/script/template.jai
@@ -0,0 +1,26 @@
//#!/usr/local/bin/jai /** adapt this path */
#import "Basic"()(MEMORY_DEBUGGER = MEMORY_DEBUGGER_ENABLED);
#import "Compiler";
MEMORY_DEBUGGER_ENABLED :: false;
#run {
#if MEMORY_DEBUGGER_ENABLED defer report_memory_leaks();
log("Hello, Sailor!");
// Run this with `jai main.jai` or if you have the
// shebang set up: `./main.jai`
}
#run {
set_build_options_dc(.{ do_output = false });
target_options := get_build_options(-1);
target_options.text_output_flags = 0;
}
main :: () {}