ruvector_scipix/cli/
mod.rs1pub mod commands;
2pub mod output;
3
4use clap::{Parser, Subcommand};
5use std::path::PathBuf;
6
7#[derive(Parser, Debug)]
9#[command(
10 name = "scipix-cli",
11 version,
12 about = "A Rust-based CLI for Scipix OCR processing",
13 long_about = "Process images with OCR, extract mathematical formulas, and convert to LaTeX or other formats.\n\n\
14 Supports single file processing, batch operations, and API server mode."
15)]
16pub struct Cli {
17 #[arg(
19 short,
20 long,
21 global = true,
22 env = "MATHPIX_CONFIG",
23 help = "Path to configuration file"
24 )]
25 pub config: Option<PathBuf>,
26
27 #[arg(
29 short,
30 long,
31 global = true,
32 help = "Enable verbose logging (DEBUG level)"
33 )]
34 pub verbose: bool,
35
36 #[arg(
38 short,
39 long,
40 global = true,
41 conflicts_with = "verbose",
42 help = "Suppress all non-error output"
43 )]
44 pub quiet: bool,
45
46 #[arg(
48 short,
49 long,
50 global = true,
51 default_value = "text",
52 help = "Output format for results"
53 )]
54 pub format: OutputFormat,
55
56 #[command(subcommand)]
57 pub command: Commands,
58}
59
60#[derive(Subcommand, Debug)]
61pub enum Commands {
62 Ocr(commands::ocr::OcrArgs),
64
65 Batch(commands::batch::BatchArgs),
67
68 Serve(commands::serve::ServeArgs),
70
71 Mcp(commands::mcp::McpArgs),
73
74 Config(commands::config::ConfigArgs),
76
77 Doctor(commands::doctor::DoctorArgs),
79
80 Version,
82
83 Completions {
85 #[arg(value_enum)]
87 shell: Option<clap_complete::Shell>,
88 },
89}
90
91#[derive(Debug, Clone, Copy, clap::ValueEnum)]
92pub enum OutputFormat {
93 Text,
95 Json,
97 Latex,
99 Markdown,
101 MathMl,
103}
104
105impl std::fmt::Display for OutputFormat {
106 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
107 match self {
108 OutputFormat::Text => write!(f, "text"),
109 OutputFormat::Json => write!(f, "json"),
110 OutputFormat::Latex => write!(f, "latex"),
111 OutputFormat::Markdown => write!(f, "markdown"),
112 OutputFormat::MathMl => write!(f, "mathml"),
113 }
114 }
115}