oxur_cli/
lib.rs

1//! Oxur CLI library and binary
2//!
3//! This crate provides two things:
4//!
5//! 1. **Library**: Common utilities for building Oxur CLI tools
6//!    - File I/O helpers (stdin/stdout/file handling)
7//!    - Colored terminal output (success, error, info, warnings)
8//!    - Progress tracking for long-running operations
9//!
10//! 2. **Binary**: The unified `oxur` command-line tool
11//!
12//! # Library Usage
13//!
14//! Add to your CLI's `Cargo.toml`:
15//!
16//! ```toml
17//! [dependencies]
18//! oxur-cli = { path = "../oxur-cli" }
19//! ```
20//!
21//! ## Basic I/O
22//!
23//! ```no_run
24//! use oxur_cli::common::io::{read_input, write_output};
25//! use std::path::PathBuf;
26//!
27//! # fn main() -> anyhow::Result<()> {
28//! // Read from file or stdin
29//! let content = read_input(&PathBuf::from("input.txt"))?;
30//!
31//! // Write to file or stdout
32//! write_output(&content, Some(&PathBuf::from("output.txt")))?;
33//! # Ok(())
34//! # }
35//! ```
36//!
37//! ## Colored Output
38//!
39//! ```no_run
40//! use oxur_cli::common::output::{success, error, info};
41//!
42//! success("Operation completed!");
43//! error("Something went wrong");
44//! info("Processing files...");
45//! ```
46//!
47//! ## Progress Tracking
48//!
49//! ```no_run
50//! use oxur_cli::common::progress::ProgressTracker;
51//!
52//! # fn main() -> anyhow::Result<()> {
53//! let mut progress = ProgressTracker::new(true);
54//!
55//! progress.step("Loading data");
56//! // ... do work ...
57//! progress.done();
58//!
59//! progress.step("Processing data");
60//! // ... do work ...
61//! progress.done();
62//!
63//! progress.success("All done!");
64//! # Ok(())
65//! # }
66//! ```
67
68pub mod common;
69pub mod config;
70pub mod table;
71
72// Args module requires clap (part of binary feature)
73#[cfg(feature = "binary")]
74pub mod args;
75
76// REPL module requires binary feature dependencies
77#[cfg(feature = "binary")]
78pub mod repl;
79
80// Re-export commonly used items for convenience
81pub use common::progress::ProgressTracker;
82pub use config::{EditMode, HistoryConfig, ReplConfig, TerminalConfig};
83
84// Re-export args when available
85#[cfg(feature = "binary")]
86pub use args::ReplArgs;