Library surface for user binaries to host umbral's management subcommands.
umbral-cli ships as two artefacts. The library (this crate) exposes
[dispatch] — the entry point user binaries call to gain the
serve / migrate / makemigrations / inspectdb /
dumpdata / loaddata subcommands. The binary (umbral) ships as
the global scaffolding tool installed via cargo install umbral-cli, and handles startproject / startapp from outside
any project.
Quickstart
In your project's src/main.rs:
use umbral::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
tracing_subscriber::fmt::init();
let settings = Settings::from_env()?;
let pool = umbral::db::connect(&settings.database_url).await?;
let app = App::builder()
.settings(settings)
.database("default", pool)
.model::<Article>()
.build()?;
umbral_cli::dispatch(app).await
}
Then:
The subcommands run against the published ambient state (pool,
model registry) that App::build set up, so they see every model
and plugin the user wired into the builder.