terminal_demo/
terminal_demo.rs

1//! Simple demo to manually verify terminal features
2//!
3//! Run with different terminal widths:
4//! ```bash
5//! # Default width
6//! cargo run --example terminal_demo
7//!
8//! # Narrow terminal
9//! COLUMNS=50 cargo run --example terminal_demo
10//!
11//! # Wide terminal  
12//! COLUMNS=100 cargo run --example terminal_demo
13//! ```
14
15use flag_rs::{CommandBuilder, Flag, FlagType, FlagValue};
16
17fn main() {
18    let app = CommandBuilder::new("demo")
19        .short("Terminal feature demonstration")
20        .long("This application demonstrates the terminal width detection and text wrapping features. The help text should automatically adjust to your terminal width, wrapping long lines at word boundaries while maintaining readability. Try running this with different COLUMNS values to see how it adapts.")
21        .flag(
22            Flag::new("file")
23                .short('f')
24                .usage("Input file path. This flag expects a path to a file that will be processed. The file must exist and be readable.")
25                .value_type(FlagType::String)
26        )
27        .flag(
28            Flag::new("output-format")
29                .short('o')
30                .usage("Output format for results. Supported formats include: json (machine-readable JSON format), yaml (human-friendly YAML format), table (formatted ASCII table), csv (comma-separated values for spreadsheet import)")
31                .value_type(FlagType::String)
32                .default(FlagValue::String("table".to_string()))
33        )
34        .subcommand(
35            CommandBuilder::new("process")
36                .short("Process data with various transformations and filters that can be applied in sequence")
37                .build()
38        )
39        .build();
40
41    // Always show help for this demo
42    app.print_help();
43}