Open Darkfllame opened 1 week ago
in the past there was zig init-exe
and zig init-lib
, which got merged into one. i don't know which issue or pr that was.
I'd personally recommend using https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository
I'd personally recommend using https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository
No I mean a thing that is WITH the zig executable, so you wouldn't need other tools and more setup
in the past there was
zig init-exe
andzig init-lib
, which got merged into one. i don't know which issue or pr that was.
I just started to look at making a zig init -m
switch for myself to make a minimal template.
I realized we create already create our own zig init
template simply by replacing the four files in lib/init/
and lib/init/src/
, but we're restricted to using those exact filenames and must use all of them.
I don't think that's supported/documented. But it would be a minor change to allow it and replace the logic which relies specifically on main.zig
and root.zig
and copy all .zig
files, or even more minimally, to only copy root.zig
if it's present in lib/init/src/
.
I'd love the ability to select between multiple, hard-coded templates: to build a library (no example code, no comments), an executable (same), both (same), a fully commented example (like the current template), a template to compile a C project, etc.
So I was thinking about a thing that would be pretty convenient, init templates, basically let you save templates to use with
zig init
to have custom project templates. I though about a few commands for it:zig init --save <name>
in a folder to save the folder as a template (maybe adding some sort of.zigignore
file or something, I know there's an issue about it somewhere)zig init <name>
to load a saved template, it not found, just outputs an error.The goal ? Some may find it pretty convenient, personally it would since, when initializing a new project, I always delete comments, delete
src/root.zig
and clean up the build file andsrc/main.zig
, which I do a lot since I'm always restarting old projects and all.I might get instant rejected but I just wanted to put this here. If this was already planned, then sorry but I didn't find any proposals about this and I don't remember it being on zig's "todo list".
To be honest, I don't know how I should format a proposal, and I'm kind of tired and a bit lazy so I'll just put this here like this.