cargo +1.56.1 update

This commit is contained in:
Niyaz Nigmatullin 2022-08-16 15:26:26 +03:00
parent 3acbd1c048
commit f4df7ea4a0
3 changed files with 338 additions and 223 deletions

543
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -147,9 +147,7 @@ fn gen_completions<T: uucore::Args>(
)
.arg(
Arg::new("shell")
.value_parser(clap::builder::PossibleValuesParser::new(
Shell::possible_values(),
))
.value_parser(clap::builder::EnumValueParser::<Shell>::new())
.required(true),
)
.get_matches_from(std::iter::once(OsString::from("completion")).chain(args));

View file

@ -18,6 +18,7 @@ use std::{
extern crate nix;
use clap::{crate_version, Arg, Command};
use crossterm::event::KeyEventKind;
use crossterm::{
event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
execute, queue,
@ -229,13 +230,21 @@ fn more(buff: &str, stdout: &mut Stdout, next_file: Option<&str>, silent: bool)
let mut wrong_key = None;
if event::poll(Duration::from_millis(10)).unwrap() {
match event::read().unwrap() {
Event::Key(KeyEvent {
kind: KeyEventKind::Release,
..
}) => continue,
Event::Key(KeyEvent {
code: KeyCode::Char('q'),
modifiers: KeyModifiers::NONE,
kind: KeyEventKind::Press,
..
})
| Event::Key(KeyEvent {
code: KeyCode::Char('c'),
modifiers: KeyModifiers::CONTROL,
kind: KeyEventKind::Press,
..
}) => {
reset_term(stdout);
std::process::exit(0);
@ -243,10 +252,12 @@ fn more(buff: &str, stdout: &mut Stdout, next_file: Option<&str>, silent: bool)
Event::Key(KeyEvent {
code: KeyCode::Down,
modifiers: KeyModifiers::NONE,
..
})
| Event::Key(KeyEvent {
code: KeyCode::Char(' '),
modifiers: KeyModifiers::NONE,
..
}) => {
if pager.should_close() {
return Ok(());
@ -257,12 +268,14 @@ fn more(buff: &str, stdout: &mut Stdout, next_file: Option<&str>, silent: bool)
Event::Key(KeyEvent {
code: KeyCode::Up,
modifiers: KeyModifiers::NONE,
..
}) => {
pager.page_up();
}
Event::Key(KeyEvent {
code: KeyCode::Char('j'),
modifiers: KeyModifiers::NONE,
..
}) => {
if pager.should_close() {
return Ok(());
@ -273,6 +286,7 @@ fn more(buff: &str, stdout: &mut Stdout, next_file: Option<&str>, silent: bool)
Event::Key(KeyEvent {
code: KeyCode::Char('k'),
modifiers: KeyModifiers::NONE,
..
}) => {
pager.prev_line();
}