file-kitty 0.2.0

A versatile file manipulation toolkit with async support
Documentation
use clap::{Parser, Subcommand};
use file_kitty::encoding::scan_directory;

#[derive(Parser)]
#[command(
    author, 
    version, 
    about = "A versatile file manipulation toolkit",
    long_about = None
)]
struct Cli {
    #[command(subcommand)]
    command: Commands,
}

#[derive(Subcommand)]
enum Commands {
    /// Detect and convert file encodings
    Encoding {
        /// The path of the directory to scan
        #[arg(short, long)]
        path: String,

        /// Convert files to UTF-8 automatically
        #[arg(short, long)]
        convert: bool,

        /// Show detailed encoding information
        #[arg(short, long)]
        verbose: bool,

        /// File extensions to process (comma-separated, e.g., "c,h,cpp,rs")
        /// If not specified, uses default text file extensions
        #[arg(short, long, value_delimiter = ',')]
        types: Option<Vec<String>>,
    },
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let cli = Cli::parse();

    match cli.command {
        Commands::Encoding { path, convert, verbose, types } => {
            scan_directory(&path, convert, verbose, types).await?;
        }
    }

    Ok(())
}