fob_cli/cli/
mod.rs

1//! Command-line interface definition for Fob bundler.
2//!
3//! This module defines the complete CLI structure using clap v4's derive macros.
4//! It provides type-safe argument parsing with comprehensive validation and
5//! clear error messages.
6//!
7//! # Command Structure
8//!
9//! - `fob build` - Bundle JavaScript/TypeScript with full configuration
10//! - `fob dev` - Development server with watch mode (planned)
11//! - `fob init` - Project scaffolding (planned)
12//! - `fob check` - Configuration validation (planned)
13
14mod commands;
15pub mod enums;
16mod tests;
17mod validation;
18
19use clap::Parser;
20
21pub use commands::{BuildArgs, CheckArgs, Command, DevArgs, InitArgs};
22pub use enums::*;
23pub use validation::parse_global;
24
25/// Fob - A modern JavaScript/TypeScript bundler
26#[derive(Parser, Debug)]
27#[command(
28    name = "fob",
29    version,
30    about = "A modern JavaScript/TypeScript bundler",
31    long_about = "Fob is a fast, modern bundler for JavaScript and TypeScript projects.\n\
32                  It provides zero-config bundling with support for ESM, CJS, and IIFE formats,\n\
33                  TypeScript declaration generation, and optimized production builds."
34)]
35pub struct Cli {
36    /// Enable verbose logging (debug level)
37    ///
38    /// Shows detailed information about the bundling process, including
39    /// file transformations, dependency resolution, and performance metrics.
40    #[arg(short, long, global = true)]
41    pub verbose: bool,
42
43    /// Suppress all output except errors
44    ///
45    /// Only critical errors will be displayed. Useful for CI/CD environments
46    /// or when piping output to other tools.
47    #[arg(short, long, global = true, conflicts_with = "verbose")]
48    pub quiet: bool,
49
50    /// Disable colored output
51    ///
52    /// Outputs plain text without ANSI color codes. Useful for logging to
53    /// files or systems that don't support colored terminal output.
54    #[arg(long, global = true)]
55    pub no_color: bool,
56
57    /// Subcommand to execute
58    #[command(subcommand)]
59    pub command: Command,
60}