log-genius 0.1.0

An AI-powered CLI to instantly analyze and explain complex logs.
Documentation
use crate::error::{AppError, Result};
use std::{fs, io};
use std::io::Read;
use std::path::PathBuf;

pub fn read_input(file_path: Option<PathBuf>) -> Result<String> {
    let mut buffer = String::new();

    match file_path {
        Some(path) => {
            buffer = fs::read_to_string(path)?;
        }
        None => {
            io::stdin().read_to_string(&mut buffer)?;
        }
    }

    if buffer.trim().is_empty() {
        eprintln!("Warning: Input is empty.");
    }

    Ok(buffer)
}