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

Function expand

crates/opencode-permission/src/ruleset.rs:38–51  ·  view source on GitHub ↗
(pattern: &str)

Source from the content-addressed store, hash-verified

36pub type ConfigPermission = HashMap<String, ConfigValue>;
37
38fn expand(pattern: &str) -> String {
39 if let Some(home) = dirs::home_dir() {
40 if pattern.starts_with("~/") {
41 return format!("{}{}", home.display(), &pattern[1..]);
42 }
43 if pattern == "~" {
44 return home.display().to_string();
45 }
46 if pattern.starts_with("$HOME/") {
47 return format!("{}{}", home.display(), &pattern[5..]);
48 }
49 }
50 pattern.to_string()
51}
52
53pub fn from_config(permission: &ConfigPermission) -> PermissionRuleset {
54 let mut ruleset: PermissionRuleset = Vec::new();

Callers 1

from_configFunction · 0.85

Calls 1

home_dirFunction · 0.85

Tested by

no test coverage detected