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