Skip to main content

Cli

Struct Cli 

Source
pub struct Cli { /* private fields */ }
Expand description

An app’s CLI: standard verbs plus its own.

Implementations§

Source§

impl Cli

Source

pub fn new( name: impl Into<String>, version: impl Into<String>, session: impl FnMut() -> Box<dyn Dispatch> + 'static, ) -> Self

session makes a fresh headless session (one per invocation).

Source

pub fn key_dir(self, dir: impl Into<PathBuf>) -> Self

Where the running app writes its control key (its settings folder); enables --connect.

Source

pub fn instructions(self, text: impl Into<String>) -> Self

The MCP server’s instructions (what the app is, how to drive it).

Source

pub fn docs(self, library: Library) -> Self

The documentation library (docs, and the MCP server’s tools and resources), usually the app’s built-in pages.

Source

pub fn user_docs(self, dir: impl Into<PathBuf>) -> Self

The user’s own documentation folder, read on top of Self::docs whenever they are used (same path: the user’s page wins). docs --where prints it; it is never created.

Source

pub fn prompts(self, category: impl Into<String>) -> Self

The documentation category mcp serves as prompts (McpServer::prompts).

Source

pub fn verb( self, name: &str, usage: &str, about: &str, run: impl FnMut(Args, &mut Io<'_>) -> Exit + 'static, ) -> Self

Add an app-specific verb (or replace a standard one of the same name).

Source

pub fn run(self) -> ExitCode

Run with the process arguments and real stdio.

Source

pub fn run_with(&mut self, args: Vec<String>, io: &mut Io<'_>) -> Exit

Run one invocation (args without the program name).

Auto Trait Implementations§

§

impl !RefUnwindSafe for Cli

§

impl !Send for Cli

§

impl !Sync for Cli

§

impl !UnwindSafe for Cli

§

impl Forget for Cli

§

impl Freeze for Cli

§

impl Move for Cli

§

impl Unpin for Cli

§

impl UnsafeUnpin for Cli

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.