mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 14:36:08 +02:00
Fixes autocomplete when using sudo (#8094)
# Description This PR addresses issue #2047 in order to enable autocomplete functionality when using sudo for executing commands. I'e done a couple of auxiliary checks such as ignoring whitespace and the last pipe in order to determine the last command. # User-Facing Changes The only user facing change should be the autocomplete working. # Tests + Formatting All tests and formatting pass. # Screenshots <img width="454" alt="image" src="https://user-images.githubusercontent.com/4399118/219404037-6cce4358-68a9-42bb-a09b-2986b10fa6cc.png"> # Suggestions welcome I still don't know the in's and out's if nushell very well, any suggestions for improvements are welcome.
This commit is contained in:
@ -1007,6 +1007,10 @@ impl EngineState {
|
||||
.map(|d| d.as_string().unwrap_or_default())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn get_file_contents(&self) -> &Vec<(Vec<u8>, usize, usize)> {
|
||||
&self.file_contents
|
||||
}
|
||||
}
|
||||
|
||||
/// A temporary extension to the global state. This handles bridging between the global state and the
|
||||
@ -1191,6 +1195,10 @@ impl StateDelta {
|
||||
pub fn exit_scope(&mut self) {
|
||||
self.scope.pop();
|
||||
}
|
||||
|
||||
pub fn get_file_contents(&self) -> &Vec<(Vec<u8>, usize, usize)> {
|
||||
&self.file_contents
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StateWorkingSet<'a> {
|
||||
|
Reference in New Issue
Block a user