MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / short_id

Function short_id

crates/opencode-tui/src/components/revert_card.rs:111–127  ·  view source on GitHub ↗
(value: &str)

Source from the content-addressed store, hash-verified

109}
110
111fn short_id(value: &str) -> String {
112 let trimmed = value.trim();
113 let count = trimmed.chars().count();
114 if count <= 12 {
115 return trimmed.to_string();
116 }
117 let prefix: String = trimmed.chars().take(6).collect();
118 let suffix: String = trimmed
119 .chars()
120 .rev()
121 .take(4)
122 .collect::<String>()
123 .chars()
124 .rev()
125 .collect();
126 format!("{prefix}…{suffix}")
127}
128
129enum DiffPreview {
130 Provided(String),

Callers

nothing calls this directly

Calls 1

countMethod · 0.80

Tested by

no test coverage detected