1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! # Xarp
//!
//! A zero-dependency, pure-Rust command-line argument parser with a
//! self-contained ANSI styling engine (24 named colors, 8-bit 256-color,
//! and 24-bit true color).
//!
//! ## Quick start
//!
//! ```rust
//! use xarp::{Arg, ArgAction, Xarp};
//!
//! let matches = Xarp::new("demo")
//! .version("0.1.2")
//! .about("A simple CLI built with xarp")
//! .arg(
//! Arg::new("verbose")
//! .short('v')
//! .long("verbose")
//! .help("Enable verbose output")
//! .action(ArgAction::SetTrue),
//! )
//! .arg(Arg::new("input").value_name("FILE").required(true))
//! .try_get_matches_from(&["demo".to_string(), "file.txt".to_string()])
//! .unwrap();
//!
//! assert!(!matches.get_flag("verbose"));
//! assert_eq!(
//! matches.get_one::<String>("input"),
//! Some("file.txt".to_string())
//! );
//! ```
//!
//! Binaries normally finish with [`Xarp::get_matches`], which prints help or
//! version and exits the process on failure; library code prefers the
//! `try_` variants, which return [`XarpError`] instead.
//!
//! ## Parsing model
//!
//! - Flags use [`ArgAction::SetTrue`] and are read with
//! [`ArgMatches::get_flag`].
//! - Options use [`ArgAction::Set`] (last occurrence wins) and accept
//! `--opt value`, `--opt=value`, `-p value`, and `-pvalue`.
//! - [`ArgAction::Append`] options (and a trailing positional) collect every
//! occurrence, read with [`ArgMatches::get_many`].
//! - Arguments without [`Arg::short`] or [`Arg::long`] are positionals,
//! matched in declaration order; tokens after `--` are always positionals.
//! - Subcommands are nested [`Xarp`] parsers; a value equal to a subcommand
//! name can still be passed as a positional behind `--`.
//!
//! ## Validation and fallbacks
//!
//! Arguments support [`Arg::required`], [`Arg::possible_values`],
//! [`Arg::conflicts_with`], [`Arg::default_value`], and [`Arg::env`]
//! fallbacks with CLI-beats-environment-beats-default precedence. Conflict
//! checks only consider explicitly supplied arguments, never defaults.
//! Typed access that distinguishes missing values from invalid ones is
//! available via [`ArgMatches::try_get_one`] and
//! [`ArgMatches::try_get_many`].
//!
//! ## Terminal styling
//!
//! [`Style`] combines a foreground [`Color`], a background color, and
//! [`Effects`] bitflags, renders ANSI escapes via [`Display`][core::fmt::Display],
//! and paints values with [`Style::paint`]. [`Styles`] themes the help,
//! version, and error output; setting `NO_COLOR` (any value, including empty)
//! disables colors.
//!
//! ## Modules
//!
//! - [`color`]: color definitions and preset styles.
//! - [`effect`]: text effect bitflags.
//! - [`style`]: styles, painting, and CLI themes.
//! - [`xarp`]: argument definitions, parsing, and matches.
//!
//! ## Examples
//!
//! The repository ships runnable examples: `basic_demo`, `advanced_cli`,
//! `styling_and_theming`, `error_handling`, `env_and_validation`, and
//! `git_style_subcommands` (see `examples/`).
/// Color definitions, ANSI escape sequence generation, and color style presets.
/// ANSI text style modifiers and font effects bitflags.
/// Text styles, ANSI output formatting, and CLI theme configurations.
/// Core command-line argument parsing and execution engine.
pub use Color;
pub use Effects;
pub use ;
pub use ;