diff options
Diffstat (limited to 'mling/src')
| -rw-r--r-- | mling/src/cli/list.rs | 4 | ||||
| -rw-r--r-- | mling/src/namespace_manager.rs | 38 |
2 files changed, 22 insertions, 20 deletions
diff --git a/mling/src/cli/list.rs b/mling/src/cli/list.rs index a0c68a0..d4088ce 100644 --- a/mling/src/cli/list.rs +++ b/mling/src/cli/list.rs @@ -79,7 +79,7 @@ pub(crate) fn render_installed(prev: ResultInstalledNamespaces) { StateListInstalledOptions::All => { print_list("Trusted".bright_green().bold().to_string(), prev.trusted, r); print_list( - "Unrusted".bright_red().bold().to_string(), + "Untrusted".bright_red().bold().to_string(), prev.untrusted, r, ); @@ -94,7 +94,7 @@ pub(crate) fn render_installed(prev: ResultInstalledNamespaces) { } StateListInstalledOptions::OnlyUntrusted => { print_list( - "Unrusted".bright_red().bold().to_string(), + "Untrusted".bright_red().bold().to_string(), prev.untrusted, r, ); diff --git a/mling/src/namespace_manager.rs b/mling/src/namespace_manager.rs index cc94f2e..51181c3 100644 --- a/mling/src/namespace_manager.rs +++ b/mling/src/namespace_manager.rs @@ -25,23 +25,24 @@ pub fn list_namespaces( let path = entry.path(); if path.is_dir() && let Some(name) = path.file_name() - && let Some(name_str) = name.to_str() { - // Skip directories starting with a dot - if name_str.starts_with('.') { - continue; - } - let namespace = name_str.to_string(); - let is_trusted = is_trusted_namespace(namespace.clone()); - let is_untrusted = is_untrusted_namespace(namespace.clone()); - let is_untagged = is_untagged_namespace(namespace.clone()); - - if (show_trusted && is_trusted) - || (show_untrusted && is_untrusted) - || (show_untagged && is_untagged) - { - namespaces.push(namespace); - } - } + && let Some(name_str) = name.to_str() + { + // Skip directories starting with a dot + if name_str.starts_with('.') { + continue; + } + let namespace = name_str.to_string(); + let is_trusted = is_trusted_namespace(namespace.clone()); + let is_untrusted = is_untrusted_namespace(namespace.clone()); + let is_untagged = is_untagged_namespace(namespace.clone()); + + if (show_trusted && is_trusted) + || (show_untrusted && is_untrusted) + || (show_untagged && is_untagged) + { + namespaces.push(namespace); + } + } } namespaces @@ -57,7 +58,8 @@ pub fn set_namespace_trusted(namespace: String, trusted: bool) { let _ = std::fs::write(&trusted_file, ""); let _ = std::fs::remove_file(&untrusted_file); } else { - // Remove TRUSTED file + // Create UNTRUSTED file and remove TRUSTED if it exists + let _ = std::fs::write(&untrusted_file, ""); let _ = std::fs::remove_file(&trusted_file); } } |
