Skip to main content

odyn init

Scaffolds a new Odin project directory with a standard layout and Odyn pre-configured.

Usage

odyn init <project-name> [options]

What it creates

Running odyn init myproject produces the following:

myproject/
src/
main.odin # "Hellope, myproject!" starter
odyn_deps/ # empty, ready for dependencies
Odyn.lock # empty lockfile
ols.json # registers odyn_deps/ as the `deps` collection
LICENSE # MIT by default

The generated ols.json registers odyn_deps/ as the deps collection, so your editor's language server picks it up immediately. You still need to pass the collection flag when building:

odin run src -collection:deps=odyn_deps

Options

FlagDefaultDescription
--license <name>mitLicense to write to LICENSE. See Licenses below.
--with-readmeoffCreates a README.md stub at the project root.
--no-srcoffSkips creating src/ and places main.odin at the project root instead.
--migrateoffMigrate an existing Odin project to Odyn. See Migrating an existing project below.

Examples

# Basic project
odyn init myproject

# With Apache license and a README
odyn init myproject --license apache --with-readme

# Flat layout (no src/ directory)
odyn init myproject --no-src

# Unlicensed
odyn init myproject --license unlicense

Licenses

The --license flag accepts the following values:

ValueLicense
mitMIT License
apacheApache License 2.0
gpl3GNU General Public License v3.0
bsd2BSD 2-Clause License
bsd3BSD 3-Clause License
mpl2Mozilla Public License 2.0
unlicenseThe Unlicense
zlibzlib License
iscISC License

Passing any other string writes a plain License: <value> file instead of erroring out.

Migrating an existing project

If you already have an Odin project and want to start using Odyn without scaffolding a new directory, run:

cd myproject
odyn init --migrate

This adds odyn_deps/, ols.json, and an empty Odyn.lock to the current directory. No existing files are touched or overwritten. The command errors if ols.json has a malformed structure or already contains a deps collection, or if Odyn.lock already exists.

tip

After migrating, run odyn get to start adding dependencies and commit the resulting Odyn.lock.

Notes

  • init fails if the target directory already exists.
  • init --migrate fails if Odyn.lock already exists, or if ols.json is malformed or already contains a deps collection. Validation runs before any files are created, so a failed migration leaves your project untouched.
  • The project name is used verbatim as the directory name and inside main.odin's package name.