diff --git a/.github/.typos.toml b/.github/.typos.toml index 66420ee68a..6d7b96d422 100644 --- a/.github/.typos.toml +++ b/.github/.typos.toml @@ -11,3 +11,4 @@ Plasticos = "Plasticos" IIF = "IIF" numer = "numer" ratatui = "ratatui" +doas = "doas" diff --git a/crates/nu-cli/src/completions/command_completions.rs b/crates/nu-cli/src/completions/command_completions.rs index c99c00985e..371627a9ef 100644 --- a/crates/nu-cli/src/completions/command_completions.rs +++ b/crates/nu-cli/src/completions/command_completions.rs @@ -234,7 +234,7 @@ pub fn is_passthrough_command(working_set_file_contents: &[(Vec, usize, usiz let cur_pos = find_non_whitespace_index(contents, last_pipe_pos); let result = match contents.get(cur_pos..) { - Some(contents) => contents.starts_with(b"sudo "), + Some(contents) => contents.starts_with(b"sudo ") || contents.starts_with(b"doas "), None => false, }; if result { diff --git a/crates/nu-cli/src/completions/completer.rs b/crates/nu-cli/src/completions/completer.rs index 66afe3999a..cbd89b3bcf 100644 --- a/crates/nu-cli/src/completions/completer.rs +++ b/crates/nu-cli/src/completions/completer.rs @@ -136,7 +136,9 @@ impl NuCompleter { for (flat_idx, flat) in flattened.iter().enumerate() { let is_passthrough_command = spans .first() - .filter(|content| content.as_str() == "sudo") + .filter(|content| { + content.as_str() == "sudo" || content.as_str() == "doas" + }) .is_some(); // Read the current spam to string let current_span = working_set.get_span_contents(flat.0).to_vec();