Skip to main content

iris_reader/
cli.rs

1use std::path::PathBuf;
2
3use clap::{ArgAction, Parser, ValueEnum};
4
5use crate::options::IconMode;
6
7#[derive(Debug, Clone, Copy, ValueEnum, PartialEq, Eq)]
8pub enum FormatArg {
9    Auto,
10    Text,
11    Markdown,
12}
13
14#[derive(Debug, Parser)]
15#[command(
16    name = "iris",
17    version,
18    about = "Terminal-native viewing for documents and data",
19    long_about = None
20)]
21pub struct Cli {
22    /// File to open. If omitted, IRIS reads piped stdin.
23    pub input: Option<PathBuf>,
24
25    /// Force the input format (useful for stdin).
26    #[arg(long, value_enum, default_value_t = FormatArg::Auto)]
27    pub format: FormatArg,
28
29    /// Theme name from the IRIS themes directory or a path to a theme TOML file.
30    #[arg(long)]
31    pub theme: Option<String>,
32
33    /// List available themes and exit.
34    #[arg(long)]
35    pub list_themes: bool,
36
37    /// Icon set used by alerts, task lists, and image placeholders.
38    #[arg(long, value_enum)]
39    pub icons: Option<IconMode>,
40
41    /// Enable text wrapping for prose.
42    #[arg(long, action = ArgAction::SetTrue, conflicts_with = "no_wrap")]
43    pub wrap: bool,
44
45    /// Disable text wrapping for prose.
46    #[arg(long, action = ArgAction::SetTrue, conflicts_with = "wrap")]
47    pub no_wrap: bool,
48}