| name | nullable-request-body-custom-commands |
| description | How to author custom commands for the nullable-request-body CLI using the co-generated SDK. |
Custom Commands for nullable-request-body
Overview
The nullable-request-body 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/nullable-request-body/custom.rs ← Your command handlers (protected by .fernignore)
cli/nullable-request-body/sdk.rs ← Generated bridge: client() + block_on()
cli/nullable-request-body/main.rs ← Generated entrypoint (calls custom::register)
nullable-request-body-sdk/ ← Co-generated typed SDK crate
nullable-request-body-types/ ← Co-generated typed model crate
Adding a Custom Command
1. Edit cli/nullable-request-body/custom.rs
This file is protected by .fernignore — fern generate will never
overwrite it. Register commands in the register() function:
use nullable_request_body_sdk::api::*;
pub fn register(app: CliApp) -> CliApp {
let app = app.command(
clap::Command::new("test-method-name")
.about("Post Nullable Request Body")
.(clap::Arg::().())
,
|matches, ctx| {
= matches.get_one::<>().();
= super::sdk::(ctx);
= super::sdk::(
client.test_group.(path_param),
)?;
(, serde_json::(&result).());
(())
},
);
app
}