Skip to content

Getting started

Install

comline is not on crates.io yet — build it from source with a recent Rust toolchain:

git clone https://github.com/ComlineProject/cli
cd cli
cargo install --path .

That puts the comline binary in ~/.cargo/bin. Check it:

comline --help

A cargo install comline from crates.io, and OS packages (Fedora, Arch, Windows, macOS), are planned — packaging is tracked in ComlineProject/distributions.

Create a project

comline new my-api
cd my-api

You get:

my-api/
├── config.idp        # package manifest
├── comline.toml       # where generated code goes (all-commented by default)
├── src/
│   └── main.ids      # a sample schema
└── .gitignore        # ignores .comline/

src/main.ids:

/// The language a greeting is written in.
enum Language {
    English
    Spanish
    Japanese
}

struct Greeting {
    message: string
    language: Language
}

Build

comline build

This compiles and validates the schemas, then freezes the result as version 0.0.1 in a content-addressable store under .comline/. Later builds bump the version automatically by the largest change since the last one.

Validate without freezing — safe for editors and pre-commit hooks:

comline check

Generate code

comline generate

Targets come from code_generation.languages in config.idp (the scaffold declares rust#1.70.0); output lands under generated/ by default. Change where and how in comline.toml:

[generate]
out    = "src/generated"
layout = "{{language}}/{{namespace}}.{{ext}}"

Today rust is the only generator.

Next