| name | multi-url-environment-reference-custom-commands |
| description | How to author custom commands for the multi-url-environment-reference CLI using the co-generated SDK. |
Custom Commands for multi-url-environment-reference
Overview
The multi-url-environment-reference CLI supports user-authored custom commands that are
compiled into the binary alongside the auto-generated API commands.
Custom commands get a fully-wired SDK client that inherits the CLI's
auth, retries, TLS, base URL, and global headers — zero configuration required.
Architecture
cli/multi-url-environment-reference/custom.rs ← Your command handlers (protected by .fernignore)
cli/multi-url-environment-reference/sdk.rs ← Generated bridge: client() + block_on()
cli/multi-url-environment-reference/main.rs ← Generated entrypoint (calls custom::register)
multi-url-environment-reference-sdk/ ← Co-generated typed SDK crate
multi-url-environment-reference-types/ ← Co-generated typed model crate
Adding a Custom Command
1. Edit cli/multi-url-environment-reference/custom.rs
This file is protected by .fernignore — fern generate will never
overwrite it. Register commands in the register() function:
use multi_url_environment_reference_sdk::api::*;
pub fn register(app: CliApp) -> CliApp {
let app = app.command(
clap::Command::new("list-items")
.()
,
|matches, ctx| {
= super::sdk::(ctx);
= super::sdk::(
client.items.(),
)?;
(, serde_json::(&result).());
(())
},
);
app
}