pub struct CliHelpScreen {
pub title: String,
pub usage: String,
pub description: String,
pub params: IndexMap<String, String>,
pub flags: IndexMap<String, String>,
pub examples: Vec<String>,
}Expand description
Structure representing a help screen for a CLI command.
This struct contains all the information needed to render a complete help screen, including title, usage, description, parameters, flags, and examples.
Fields§
§title: StringThe title displayed at the top of the help screen.
usage: StringUsage string showing how to invoke the command.
description: StringDetailed description of what the command does.
params: IndexMap<String, String>Map of parameter names to their descriptions.
flags: IndexMap<String, String>Map of flag names to their descriptions.
examples: Vec<String>List of example command invocations.
Implementations§
Source§impl CliHelpScreen
impl CliHelpScreen
Sourcepub fn new(title: &str, usage: &str, description: &str) -> Self
pub fn new(title: &str, usage: &str, description: &str) -> Self
Creates a new help screen with the specified title, usage, and description.
§Arguments
title- The title displayed at the top of the help screenusage- Usage string showing how to invoke the commanddescription- Detailed description of what the command does
§Example
use falcon_cli::CliHelpScreen;
let help = CliHelpScreen::new(
"My Command",
"myapp command [OPTIONS]",
"This command does something useful"
);Sourcepub fn add_example(&mut self, example: &str)
pub fn add_example(&mut self, example: &str)
Sourcepub fn render(
cmd: &Box<dyn CliCommand>,
cmd_alias: &String,
shortcuts: &Vec<String>,
)
pub fn render( cmd: &Box<dyn CliCommand>, cmd_alias: &String, shortcuts: &Vec<String>, )
Renders and displays the help screen for a specific CLI command.
This method is automatically executed when the first argument passed via the command line is ‘help’ or ‘-h’. It should not typically be called manually.
§Arguments
cmd- The CLI command to display help forcmd_alias- The primary alias/name of the commandshortcuts- List of shortcut aliases for the command
Sourcepub fn render_index(router: &CliRouter)
pub fn render_index(router: &CliRouter)
Renders and displays the main help index for the application.
This method is automatically executed when the first and only argument passed via the command line is ‘help’ or ‘-h’. It displays either all available categories or CLI commands depending on whether categories have been added to the router.
§Arguments
router- The CLI router containing all registered commands and categories
Sourcepub fn render_category(router: &CliRouter, cat_alias: &String)
pub fn render_category(router: &CliRouter, cat_alias: &String)
Renders and displays help for a specific category.
This method is only applicable when using multiple categories to organize groups of CLI commands. It is automatically executed when the first argument via command line is either ‘help’ or ‘-h’, and the second argument is the name of a category. It displays all CLI commands available within that category.
§Arguments
router- The CLI router containing all registered commands and categoriescat_alias- The alias/name of the category to display
Auto Trait Implementations§
impl Freeze for CliHelpScreen
impl RefUnwindSafe for CliHelpScreen
impl Send for CliHelpScreen
impl Sync for CliHelpScreen
impl Unpin for CliHelpScreen
impl UnwindSafe for CliHelpScreen
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more