MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / truncate_text

Function truncate_text

crates/opencode-cli/src/main.rs:2230–2240  ·  view source on GitHub ↗
(input: &str, max_chars: usize)

Source from the content-addressed store, hash-verified

2228}
2229
2230fn truncate_text(input: &str, max_chars: usize) -> String {
2231 if input.chars().count() <= max_chars {
2232 return input.to_string();
2233 }
2234 let mut out = String::new();
2235 for c in input.chars().take(max_chars.saturating_sub(2)) {
2236 out.push(c);
2237 }
2238 out.push_str("..");
2239 out
2240}
2241
2242fn local_database_path() -> PathBuf {
2243 dirs::data_local_dir()

Callers 2

github_commit_allFunction · 0.70
github_summary_titleFunction · 0.70

Calls 2

newFunction · 0.85
countMethod · 0.80

Tested by

no test coverage detected