csusage-core 0.0.1

Coding agent CLI usage reports (ccusage fork with Claude Science support)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::path::PathBuf;

pub fn expand_home_path(raw: &str) -> PathBuf {
    if raw == "~"
        && let Some(home) = crate::home::home_dir()
    {
        return home;
    }
    if let Some(rest) = raw.strip_prefix("~/")
        && let Some(home) = crate::home::home_dir()
    {
        return home.join(rest);
    }
    PathBuf::from(raw)
}