MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / unique_provider_name

Function unique_provider_name

crates/openshell-tui/src/app.rs:2800–2811  ·  view source on GitHub ↗

Generate a unique provider name by appending `-1`, `-2`, etc. if needed.

(base: &str, existing: &[String])

Source from the content-addressed store, hash-verified

2798
2799/// Generate a unique provider name by appending `-1`, `-2`, etc. if needed.
2800fn unique_provider_name(base: &str, existing: &[String]) -> String {
2801 if !existing.iter().any(|n| n == base) {
2802 return base.to_string();
2803 }
2804 for i in 1..100 {
2805 let candidate = format!("{base}-{i}");
2806 if !existing.iter().any(|n| n == &candidate) {
2807 return candidate;
2808 }
2809 }
2810 base.to_string()
2811}
2812
2813/// Compute a new scroll position after applying `delta`, clamped so the last
2814/// viewport of content remains visible.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected