Module cli

Source
Expand description

CLI module that defines command-line arguments and options.

This module provides the structures and enums necessary for parsing and validating command-line arguments. It uses the clap crate for argument parsing and defines various options for file listing and display.

§Examples

Basic usage:

use fmql::cli::{Args, SortOption, GroupByOption, OutputFormat};
use std::path::PathBuf;

// Create arguments for listing text files sorted by size
let args = Args {
    path: PathBuf::from("."),
    long_view: true,
    show_total: false,
    recursive: true,
    show_hidden: false,
    group_by: GroupByOption::Extension,
    name_pattern: Some("*.txt".to_string()),
    sort_by: SortOption::Size,
    output_format: OutputFormat::Text,
};

// Validate the arguments
if let Err(e) = args.validate() {
    eprintln!("Invalid arguments: {}", e);
}

Structs§

Args
Command-line arguments for file listing operations.

Enums§

GroupByOption
Grouping options for file listing.
OutputFormat
Output format options for file listings.
SortOption
Sort options for file listing.