aranet_cli/
lib.rs

1//! Command-line interface for Aranet environmental sensors.
2//!
3//! This crate provides a comprehensive CLI for interacting with Aranet devices
4//! including the Aranet4, Aranet2, AranetRn+ (Radon), and Aranet Radiation sensors.
5//!
6//! # Features
7//!
8//! - **Device scanning**: Discover nearby Aranet devices via BLE
9//! - **Current readings**: Display real-time sensor values with color-coded status
10//! - **Historical data**: Download and export measurement history
11//! - **Device configuration**: Adjust measurement interval, Bluetooth range, and Smart Home mode
12//! - **Continuous monitoring**: Watch mode for ongoing data collection
13//! - **Multiple output formats**: Text, JSON, and CSV output support
14//! - **Configuration file**: Persistent settings for default device and preferences
15//! - **Shell completions**: Generate completions for bash, zsh, fish, and PowerShell
16//!
17//! # Commands
18//!
19//! | Command | Description |
20//! |---------|-------------|
21//! | `scan` | Scan for nearby Aranet devices |
22//! | `read` | Read current sensor values |
23//! | `status` | Quick one-line status display |
24//! | `history` | Download historical data |
25//! | `info` | Display device information |
26//! | `set` | Configure device settings |
27//! | `watch` | Continuously monitor a device |
28//! | `config` | Manage CLI configuration |
29//! | `completions` | Generate shell completions |
30//!
31//! # Output Formats
32//!
33//! The CLI supports three output formats:
34//!
35//! - **Text** (default): Human-readable colored output
36//! - **JSON**: Machine-readable JSON format
37//! - **CSV**: Comma-separated values for spreadsheets and data analysis
38//!
39//! # Configuration
40//!
41//! The CLI stores configuration in `~/.config/aranet/config.toml` (or platform equivalent).
42//! Configuration options include:
43//!
44//! - `device`: Default device address
45//! - `format`: Default output format
46//! - `no_color`: Disable colored output
47//! - `fahrenheit`: Use Fahrenheit for temperature display
48//!
49//! # Environment Variables
50//!
51//! - `ARANET_DEVICE`: Default device address (overridden by `--device` flag)
52//! - `NO_COLOR`: Disable colored output when set
53//!
54//! # Examples
55//!
56//! Scan for devices:
57//! ```bash
58//! aranet scan
59//! ```
60//!
61//! Read current values from a specific device:
62//! ```bash
63//! aranet read --device AA:BB:CC:DD:EE:FF
64//! ```
65//!
66//! Download history as CSV:
67//! ```bash
68//! aranet history --device AA:BB:CC:DD:EE:FF --format csv --output data.csv
69//! ```
70//!
71//! Watch a device continuously:
72//! ```bash
73//! aranet watch --device AA:BB:CC:DD:EE:FF --interval 60
74//! ```
75//!
76//! Set measurement interval:
77//! ```bash
78//! aranet set --device AA:BB:CC:DD:EE:FF interval 5
79//! ```
80
81// This crate is primarily a binary CLI application.
82// The main entry point and command implementations are in main.rs.
83// This lib.rs serves as documentation and could be extended to expose
84// public APIs for programmatic use if needed in the future.
85
86// Re-export core dependencies for convenience
87pub use aranet_core;
88pub use aranet_types;
89
90// TUI module - publicly exposed for aranet-tui crate to use
91#[cfg(feature = "tui")]
92pub mod tui;
93
94// GUI module - publicly exposed for aranet-gui crate to use
95#[cfg(feature = "gui")]
96pub mod gui;