Skip to main content

CliFlag

Enum CliFlag 

Source
pub enum CliFlag {
Show 41 variants AddDir(Vec<PathBuf>), Agent(String), Agents(String), AllowDangerouslySkipPermissions, AllowedTools(Vec<String>), AppendSystemPrompt(String), Betas(Vec<String>), Chrome, Continue, DangerouslySkipPermissions, Debug(Option<String>), DebugFile(PathBuf), DisableSlashCommands, DisallowedTools(Vec<String>), FallbackModel(String), File(Vec<String>), ForkSession, FromPr(Option<String>), IncludePartialMessages, InputFormat(InputFormat), JsonSchema(String), MaxBudgetUsd(f64), McpConfig(Vec<String>), McpDebug, Model(String), NoChrome, NoSessionPersistence, OutputFormat(OutputFormat), PermissionMode(PermissionMode), PermissionPromptTool(String), PluginDir(Vec<PathBuf>), Print, ReplayUserMessages, Resume(Option<String>), SessionId(String), SettingSources(String), Settings(String), StrictMcpConfig, SystemPrompt(String), Tools(Vec<String>), Verbose,
}
Expand description

Comprehensive enum of all Claude CLI flags.

This enum represents every flag available in the Claude CLI (claude --help). Each variant carries the appropriate data type for its flag value.

Use as_flag() to get the CLI flag string (e.g., "--model"), or to_args() to get the complete flag + value as CLI arguments.

§Example

use claude_codes::CliFlag;

let flag = CliFlag::Model("sonnet".to_string());
assert_eq!(flag.as_flag(), "--model");
assert_eq!(flag.to_args(), vec!["--model", "sonnet"]);

Variants§

§

AddDir(Vec<PathBuf>)

Additional directories to allow tool access to

§

Agent(String)

Agent for the current session

§

Agents(String)

JSON object defining custom agents

§

AllowDangerouslySkipPermissions

Enable bypassing all permission checks as an option

§

AllowedTools(Vec<String>)

Tool names to allow (e.g. “Bash(git:*) Edit”)

§

AppendSystemPrompt(String)

Append to the default system prompt

§

Betas(Vec<String>)

Beta headers for API requests (API key users only)

§

Chrome

Enable Claude in Chrome integration

§

Continue

Continue the most recent conversation

§

DangerouslySkipPermissions

Bypass all permission checks

§

Debug(Option<String>)

Enable debug mode with optional category filter

§

DebugFile(PathBuf)

Write debug logs to a specific file path

§

DisableSlashCommands

Disable all skills/slash commands

§

DisallowedTools(Vec<String>)

Tool names to deny (e.g. “Bash(git:*) Edit”)

§

FallbackModel(String)

Automatic fallback model when default is overloaded

§

File(Vec<String>)

File resources to download at startup (format: file_id:relative_path)

§

ForkSession

Create a new session ID when resuming instead of reusing original

§

FromPr(Option<String>)

Resume a session linked to a PR

§

IncludePartialMessages

Include partial message chunks as they arrive

§

InputFormat(InputFormat)

Input format (text or stream-json)

§

JsonSchema(String)

JSON Schema for structured output validation

§

MaxBudgetUsd(f64)

Maximum dollar amount for API calls

§

McpConfig(Vec<String>)

Load MCP servers from JSON files or strings

§

McpDebug

Enable MCP debug mode (deprecated, use Debug instead)

§

Model(String)

Model for the current session

§

NoChrome

Disable Claude in Chrome integration

§

NoSessionPersistence

Disable session persistence

§

OutputFormat(OutputFormat)

Output format (text, json, or stream-json)

§

PermissionMode(PermissionMode)

Permission mode for the session

§

PermissionPromptTool(String)

Tool for handling permission prompts (e.g., “stdio”)

§

PluginDir(Vec<PathBuf>)

Load plugins from directories

§

Print

Print response and exit

§

ReplayUserMessages

Re-emit user messages from stdin back on stdout

§

Resume(Option<String>)

Resume a conversation by session ID

§

SessionId(String)

Use a specific session ID (UUID or tagged ID)

§

SettingSources(String)

Comma-separated list of setting sources (user, project, local)

§

Settings(String)

Path to settings JSON file or JSON string

§

StrictMcpConfig

Only use MCP servers from –mcp-config

§

SystemPrompt(String)

System prompt for the session

§

Tools(Vec<String>)

Specify available tools from the built-in set

§

Verbose

Override verbose mode setting

Implementations§

Source§

impl CliFlag

Source

pub fn as_flag(&self) -> &'static str

Get the CLI flag string (e.g., "--model")

Source

pub fn to_args(&self) -> Vec<String>

Convert this flag into CLI arguments (flag + value)

Source

pub fn all_flags() -> Vec<(&'static str, &'static str)>

Returns all CLI flag names with their flag strings.

Useful for enumerating available options in a UI or for validation.

§Example
use claude_codes::CliFlag;

for (name, flag) in CliFlag::all_flags() {
    println!("{}: {}", name, flag);
}

Trait Implementations§

Source§

impl Clone for CliFlag

Source§

fn clone(&self) -> CliFlag

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CliFlag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.