Skip to main content

token_count/cli/
mod.rs

1//! CLI module for command-line interface
2
3pub mod args;
4pub mod input;
5
6pub use args::Cli;
7pub use input::{read_stdin, read_stdin_streaming};
8
9use crate::tokenizers::registry::ModelRegistry;
10
11/// List all supported models to stdout
12pub fn list_models() {
13    let registry = ModelRegistry::global();
14    let models = registry.list_models();
15
16    println!("Supported models:\n");
17
18    for model in models {
19        println!("  {}", model.name);
20        println!("    Encoding: {}", model.encoding);
21        println!("    Context window: {} tokens", model.context_window);
22
23        if !model.aliases.is_empty() {
24            println!("    Aliases: {}", model.aliases.join(", "));
25        }
26
27        println!();
28    }
29
30    println!("Use --model to specify a model (case-insensitive)");
31    println!("Example: token-count --model gpt4");
32}
33
34#[cfg(test)]
35mod tests {
36    use super::*;
37
38    #[test]
39    fn test_list_models_runs() {
40        // Just ensure it doesn't panic
41        list_models();
42    }
43}