nori/cli
CLI module for the OpenAPI library.
Provides generate, bundle, and validate commands.
Run with: gleam run -m nori/cli
Values
pub fn derive_module_prefix(dir: String) -> String
Derive a Gleam module prefix from the configured output directory.
Looks for a src segment anywhere in the path and takes everything after
it (Gleam module paths are rooted at src/).
Examples: “./src/generated” -> “generated” “src/generated” -> “generated” “/tmp/proj/src/api/gen” -> “api/gen” “./generated” -> “generated” (relative, assumed src-rooted) “src” or “./src” -> “” (top-level — no prefix) “/tmp/out” -> “” (absolute, no src/ — unknowable)
Returning “” disables real-import emission and falls back to a comment hint.
That is always the safe answer: an unusable prefix produces a generated
import that does not parse, which is worse than no import at all.