Skip to content

Tracnac/oinit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oinit

Scaffolds a new Odin project in a subdirectory named <project_name>, initializes a git repo, and creates the first commit. The templates in assets/ are meant to be personalized by the developer — see "Customizing templates" below.

Requirements

  • Odin compiler in PATH
  • git (for the initial commit)
  • gh CLI and a GitHub account (only for the --upstream flow)

Building

Two binaries are produced: a default one and a GitHub-enabled one built with -define:WITH_GITHUB=true.

make            # tmp/oinit.bin      + tmp/oinit_github.bin
make debug      # tmp/oinit.dbg      + tmp/oinit_github.dbg
make test       # run tests
make check      # odin check + vet
make clean      # remove tmp/*

Usage

Default build:

oinit [options] <project_name>

GitHub build:

oinit_github [options] <project_name>

<project_name> must match [A-Za-z0-9_-] and the target directory must not already exist.

Options

Flag All builds GitHub build only Description
--help Show help and exit
--version Print version and exit
--upstream Create and push a GitHub repo
--private Make the upstream repo private

Examples

./tmp/oinit.bin my_app
./tmp/oinit.bin --version
./tmp/oinit_github.bin --upstream --private my_app

What it creates

<project_name>/
├── AGENTS.md
├── LICENSE
├── Makefile
├── README.md
├── .gitignore
├── .vscode/
│   ├── launch.json
│   └── tasks.json
├── lib/
├── scratch/
├── src/
│   ├── <project_name>.odin
│   └── <project_name>_test.odin
├── tmp/                 (git-ignored)
└── ols.json

A git repo is initialized and committed inside the new directory. With --upstream, gh repo create is also run from inside it.

Customizing templates

The files under assets/ are the project's templates and are intended to be edited to match your own preferences — they are not fixed. They are embedded into the binary at compile time via #load, so the produced oinit binary is self-contained and carries no runtime file dependencies — but you must rebuild after editing any template.

The scaffolded filename → asset source mapping is:

Output file Template
ols.json assets/ols.json
.gitignore assets/gitignore
.vscode/launch.json assets/launch.json
.vscode/tasks.json assets/tasks.json
src/<name>.odin assets/main.odin
src/<name>_test.odin assets/main_test.odin
AGENTS.md assets/AGENTS.md
README.md assets/README.md
LICENSE assets/LICENSE
Makefile assets/Makefile

Any occurrence of {name} in a template is replaced with the project name at scaffold time. Edit the files in assets/ freely — oinit itself imposes no opinion on their content.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors