tl_cli/cli/commands/mod.rs
1//! Subcommand implementations.
2
3use anyhow::Result;
4
5use crate::config::{ConfigFile, ConfigManager};
6
7/// Chat mode command handler.
8pub mod chat;
9
10/// Configure command handler.
11pub mod configure;
12
13/// Provider management command handler.
14pub mod providers;
15
16/// Style management command handler.
17pub mod styles;
18
19/// Translation command handler.
20pub mod translate;
21
22/// Loads the configuration file.
23///
24/// Returns defaults if the config file doesn't exist.
25/// Fails if the config file exists but is invalid or unreadable.
26pub fn load_config() -> Result<(ConfigManager, ConfigFile)> {
27 let manager = ConfigManager::new()?;
28 let config = manager.load_or_default()?;
29 Ok((manager, config))
30}