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