Skip to content

Openapi SDK async methods in Clap subcommands #9

@francescobianco

Description

@francescobianco

I have CLI commands with Clap:

let matches = App::new("CLI").get_matches();
if let Some(_) = matches.subcommand_matches("fetch") {
    sdk.get_users().await.unwrap();
}

Compiling fails because async calls are not allowed in main. How can I structure async SDK calls in a synchronous Clap CLI?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions