mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
hack
This commit is contained in:
+39
-37
@@ -318,28 +318,9 @@ fn main() {
|
|||||||
let print_errors = config.get_print_errors(&options);
|
let print_errors = config.get_print_errors(&options);
|
||||||
print_any_errors(print_errors, walk_data.errors);
|
print_any_errors(print_errors, walk_data.errors);
|
||||||
|
|
||||||
let stdin = stdin();
|
let stdin = stdin();
|
||||||
let mut out = stdout().into_raw_mode().unwrap();
|
let mut out = stdout().into_raw_mode().unwrap();
|
||||||
|
|
||||||
write!(
|
|
||||||
out,
|
|
||||||
"{}{}Dust interactive (q to quit)",
|
|
||||||
termion::clear::All,
|
|
||||||
termion::cursor::Goto(1, 1)
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
write!(out, "{}", termion::cursor::Goto(1, 2)).unwrap();
|
|
||||||
print_output(
|
|
||||||
&config,
|
|
||||||
&options,
|
|
||||||
&tree,
|
|
||||||
is_colors,
|
|
||||||
terminal_width,
|
|
||||||
&mut out,
|
|
||||||
);
|
|
||||||
out.flush().unwrap();
|
|
||||||
|
|
||||||
for c in stdin.events() {
|
|
||||||
write!(
|
write!(
|
||||||
out,
|
out,
|
||||||
"{}{}Dust interactive (q to quit)",
|
"{}{}Dust interactive (q to quit)",
|
||||||
@@ -348,20 +329,6 @@ fn main() {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
write!(out, "{}", termion::cursor::Goto(1, 2)).unwrap();
|
write!(out, "{}", termion::cursor::Goto(1, 2)).unwrap();
|
||||||
let evt = c.unwrap();
|
|
||||||
match evt {
|
|
||||||
Event::Key(Key::Char('q')) => break,
|
|
||||||
Event::Key(Key::Char(x)) => {
|
|
||||||
// println!("{}key ", x);
|
|
||||||
}
|
|
||||||
Event::Key(Key::Left) => {
|
|
||||||
// println!("left ");
|
|
||||||
}
|
|
||||||
Event::Key(Key::Right) => {
|
|
||||||
// println!("right ");
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
print_output(
|
print_output(
|
||||||
&config,
|
&config,
|
||||||
&options,
|
&options,
|
||||||
@@ -371,7 +338,42 @@ fn main() {
|
|||||||
&mut out,
|
&mut out,
|
||||||
);
|
);
|
||||||
out.flush().unwrap();
|
out.flush().unwrap();
|
||||||
}
|
|
||||||
|
for c in stdin.events() {
|
||||||
|
write!(
|
||||||
|
out,
|
||||||
|
"{}{}Dust interactive (q to quit)",
|
||||||
|
termion::clear::All,
|
||||||
|
termion::cursor::Goto(1, 1)
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
write!(out, "{}", termion::cursor::Goto(1, 2)).unwrap();
|
||||||
|
let evt = c.unwrap();
|
||||||
|
match evt {
|
||||||
|
Event::Key(Key::Char('q')) => break,
|
||||||
|
Event::Key(Key::Char(x)) => {
|
||||||
|
write!(out,"{x} key\n" );
|
||||||
|
}
|
||||||
|
Event::Key(Key::Left) => {
|
||||||
|
write!(out,"left\n");
|
||||||
|
}
|
||||||
|
Event::Key(Key::Right) => {
|
||||||
|
write!(out,"right\n");
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
write!(out, "{}", termion::cursor::Goto(1, 3)).unwrap();
|
||||||
|
print_output(
|
||||||
|
&config,
|
||||||
|
&options,
|
||||||
|
&tree,
|
||||||
|
is_colors,
|
||||||
|
terminal_width,
|
||||||
|
&mut out,
|
||||||
|
);
|
||||||
|
out.flush().unwrap();
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_output(
|
fn print_output(
|
||||||
@@ -394,7 +396,7 @@ fn print_output(
|
|||||||
short_paths: !config.get_full_paths(&options),
|
short_paths: !config.get_full_paths(&options),
|
||||||
is_reversed: !config.get_reverse(&options),
|
is_reversed: !config.get_reverse(&options),
|
||||||
colors_on: is_colors,
|
colors_on: is_colors,
|
||||||
by_filecount,
|
by_filecount: options.filecount,
|
||||||
by_filetime: config.get_filetime(&options),
|
by_filetime: config.get_filetime(&options),
|
||||||
is_screen_reader: config.get_screen_reader(&options),
|
is_screen_reader: config.get_screen_reader(&options),
|
||||||
output_format,
|
output_format,
|
||||||
|
|||||||
Reference in New Issue
Block a user