use crate::CliOverridesPatch;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum HelpScope {
Root,
Exec,
Features,
Login,
AppServer,
Sandbox,
Cloud,
Mcp,
}
impl HelpScope {
pub(crate) fn argv_prefix(&self) -> &'static [&'static str] {
match self {
HelpScope::Root => &["help"],
HelpScope::Exec => &["exec", "help"],
HelpScope::Features => &["features", "help"],
HelpScope::Login => &["login", "help"],
HelpScope::AppServer => &["app-server", "help"],
HelpScope::Sandbox => &["sandbox", "help"],
HelpScope::Cloud => &["cloud", "help"],
HelpScope::Mcp => &["mcp", "help"],
}
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct HelpCommandRequest {
pub scope: HelpScope,
pub command: Vec<String>,
pub overrides: CliOverridesPatch,
}
impl HelpCommandRequest {
pub fn new(scope: HelpScope) -> Self {
Self {
scope,
command: Vec::new(),
overrides: CliOverridesPatch::default(),
}
}
pub fn command<I, S>(mut self, tokens: I) -> Self
where
I: IntoIterator<Item = S>,
S: Into<String>,
{
self.command.extend(tokens.into_iter().map(Into::into));
self
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}