command arguments are now underlined if they match an existing path -m ran rustfmt on the entire codebase
This commit is contained in:
@@ -408,12 +408,12 @@ pub enum ShErrKind {
|
||||
ReadlineIntr(String),
|
||||
ReadlineErr,
|
||||
|
||||
// Not really errors, more like internal signals
|
||||
// Not really errors, more like internal signals
|
||||
CleanExit(i32),
|
||||
FuncReturn(i32),
|
||||
LoopContinue(i32),
|
||||
LoopBreak(i32),
|
||||
ClearReadline,
|
||||
ClearReadline,
|
||||
Null,
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ impl Display for ShErrKind {
|
||||
Self::LoopBreak(_) => "",
|
||||
Self::ReadlineIntr(_) => "",
|
||||
Self::ReadlineErr => "Readline Error",
|
||||
Self::ClearReadline => "",
|
||||
Self::ClearReadline => "",
|
||||
Self::Null => "",
|
||||
};
|
||||
write!(f, "{output}")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use termios::{LocalFlags, Termios};
|
||||
|
||||
use crate::{prelude::*};
|
||||
use crate::prelude::*;
|
||||
///
|
||||
/// The previous state of the terminal options.
|
||||
///
|
||||
@@ -33,44 +33,43 @@ pub(crate) static mut SAVED_TERMIOS: Option<Option<Termios>> = None;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TermiosGuard {
|
||||
saved_termios: Option<Termios>
|
||||
saved_termios: Option<Termios>,
|
||||
}
|
||||
|
||||
impl TermiosGuard {
|
||||
pub fn new(new_termios: Termios) -> Self {
|
||||
let mut new = Self { saved_termios: None };
|
||||
pub fn new(new_termios: Termios) -> Self {
|
||||
let mut new = Self {
|
||||
saved_termios: None,
|
||||
};
|
||||
|
||||
if isatty(std::io::stdin().as_raw_fd()).unwrap() {
|
||||
let current_termios = termios::tcgetattr(std::io::stdin()).unwrap();
|
||||
new.saved_termios = Some(current_termios);
|
||||
if isatty(std::io::stdin().as_raw_fd()).unwrap() {
|
||||
let current_termios = termios::tcgetattr(std::io::stdin()).unwrap();
|
||||
new.saved_termios = Some(current_termios);
|
||||
|
||||
termios::tcsetattr(
|
||||
std::io::stdin(),
|
||||
nix::sys::termios::SetArg::TCSANOW,
|
||||
&new_termios,
|
||||
).unwrap();
|
||||
}
|
||||
termios::tcsetattr(
|
||||
std::io::stdin(),
|
||||
nix::sys::termios::SetArg::TCSANOW,
|
||||
&new_termios,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
new
|
||||
}
|
||||
new
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for TermiosGuard {
|
||||
fn default() -> Self {
|
||||
let mut termios = termios::tcgetattr(std::io::stdin()).unwrap();
|
||||
termios.local_flags &= !LocalFlags::ECHOCTL;
|
||||
Self::new(termios)
|
||||
}
|
||||
fn default() -> Self {
|
||||
let mut termios = termios::tcgetattr(std::io::stdin()).unwrap();
|
||||
termios.local_flags &= !LocalFlags::ECHOCTL;
|
||||
Self::new(termios)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TermiosGuard {
|
||||
fn drop(&mut self) {
|
||||
if let Some(saved) = &self.saved_termios {
|
||||
termios::tcsetattr(
|
||||
std::io::stdin(),
|
||||
nix::sys::termios::SetArg::TCSANOW,
|
||||
saved,
|
||||
).unwrap();
|
||||
}
|
||||
}
|
||||
fn drop(&mut self) {
|
||||
if let Some(saved) = &self.saved_termios {
|
||||
termios::tcsetattr(std::io::stdin(), nix::sys::termios::SetArg::TCSANOW, saved).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,8 +83,7 @@ impl TkVecUtils<Tk> for Vec<Tk> {
|
||||
}
|
||||
}
|
||||
fn debug_tokens(&self) {
|
||||
for token in self {
|
||||
}
|
||||
for token in self {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user