Getting started
Install
At the moment the is no proper comline releases in crates.io, so install From source below.
After installing from any of the two options, you should now have access to the comline binary (which should be at ~/.cargo/bin). You can check by doing:
From Source (Github)
From Cargo (crates.io)
comline is on crates.io but there is no proper releases being done yet, so build from source by doing the following:
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
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
This compiles and validates the schemas, then freezes the result as a build,
0.1.0-dev.1, in a content-addressable store under .comline/. Builds lead up
to a release; when you want a version consumers see, run comline release
(the first is 0.1.0), and later releases
take the bump automatically from the largest change
since the last one.
Validate without freezing — safe for editors and pre-commit hooks:
Generate code
Targets come from code_generation.languages in config.idp (the scaffold
declares rust#1.85.0, the Rust generator's floor); output lands under generated/ by default. Change where
and how in comline.toml:
Today rust and typescript are the generators.
Next
- Overview — the whole pipeline
- IDL guide — the schema language
- Generating code — the full
generatesurface - CLI reference — every command and flag