mirror of
https://github.com/atuinsh/atuin.git
synced 2024-11-28 19:23:47 +01:00
Make clippy happy <3
This commit is contained in:
parent
242b795e8e
commit
4393a5075b
@ -159,7 +159,7 @@ fn print_list_with<'h>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
for h in h.rev() {
|
for h in h.rev() {
|
||||||
writeln!(w, "{}", fmt.with_args(&FmtHistory(&h))).expect("failed to write history");
|
writeln!(w, "{}", fmt.with_args(&FmtHistory(h))).expect("failed to write history");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +192,7 @@ pub fn print_cmd_only<'h>(w: &mut StdoutLock, h: impl DoubleEndedIterator<Item =
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Cmd {
|
impl Cmd {
|
||||||
|
#[allow(clippy::too_many_lines)]
|
||||||
pub async fn run(&self, settings: &Settings, db: &mut impl Database) -> Result<()> {
|
pub async fn run(&self, settings: &Settings, db: &mut impl Database) -> Result<()> {
|
||||||
let context = current_context();
|
let context = current_context();
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ use eyre::Result;
|
|||||||
use atuin_client::{
|
use atuin_client::{
|
||||||
database::Database,
|
database::Database,
|
||||||
database::{current_context, OptFilters},
|
database::{current_context, OptFilters},
|
||||||
history::History,
|
|
||||||
result::HistoryResult,
|
result::HistoryResult,
|
||||||
settings::{FilterMode, SearchMode, Settings},
|
settings::{FilterMode, SearchMode, Settings},
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use atuin_client::{
|
use atuin_client::{
|
||||||
database::{Context, Database},
|
database::{Context, Database},
|
||||||
history::History,
|
|
||||||
result::HistoryResult,
|
result::HistoryResult,
|
||||||
settings::{FilterMode, SearchMode},
|
settings::{FilterMode, SearchMode},
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use atuin_client::{
|
use atuin_client::{
|
||||||
database::Database, database::OptFilters, history::History, result::HistoryResult,
|
database::Database, database::OptFilters, result::HistoryResult, settings::SearchMode,
|
||||||
settings::SearchMode,
|
|
||||||
};
|
};
|
||||||
use eyre::Result;
|
use eyre::Result;
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use atuin_client::{
|
use atuin_client::{database::Database, result::HistoryResult, settings::FilterMode};
|
||||||
database::Database, history::History, result::HistoryResult, settings::FilterMode,
|
|
||||||
};
|
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use eyre::Result;
|
use eyre::Result;
|
||||||
use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher};
|
use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher};
|
||||||
|
@ -14,7 +14,6 @@ use unicode_width::UnicodeWidthStr;
|
|||||||
|
|
||||||
use atuin_client::{
|
use atuin_client::{
|
||||||
database::{current_context, Database},
|
database::{current_context, Database},
|
||||||
history::History,
|
|
||||||
result::HistoryResult,
|
result::HistoryResult,
|
||||||
settings::{ExitMode, FilterMode, SearchMode, Settings},
|
settings::{ExitMode, FilterMode, SearchMode, Settings},
|
||||||
};
|
};
|
||||||
@ -308,9 +307,9 @@ impl State {
|
|||||||
let preview = self.build_preview(results, compact, preview_width, chunks[3].width.into());
|
let preview = self.build_preview(results, compact, preview_width, chunks[3].width.into());
|
||||||
f.render_widget(preview, chunks[3]);
|
f.render_widget(preview, chunks[3]);
|
||||||
|
|
||||||
if results.len() > 0 {
|
if !results.is_empty() {
|
||||||
let selected_history = results[self.results_state.selected()].clone();
|
let selected_history = results[self.results_state.selected()].clone();
|
||||||
self.render_bar(f, &selected_history, chunks[4]);
|
Self::render_bar(f, &selected_history, chunks[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let extra_width = UnicodeWidthStr::width(self.search.input.substring());
|
let extra_width = UnicodeWidthStr::width(self.search.input.substring());
|
||||||
@ -374,18 +373,13 @@ impl State {
|
|||||||
results_list
|
results_list
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_bar<T: Backend>(
|
fn render_bar<T: Backend>(f: &mut Frame<'_, T>, history: &HistoryResult, chunk: Rect) {
|
||||||
&mut self,
|
|
||||||
f: &mut Frame<'_, T>,
|
|
||||||
history: &HistoryResult,
|
|
||||||
chunk: Rect,
|
|
||||||
) {
|
|
||||||
let bar = Layout::default()
|
let bar = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([Constraint::Ratio(9, 10), Constraint::Ratio(1, 10)].as_ref())
|
.constraints([Constraint::Ratio(9, 10), Constraint::Ratio(1, 10)].as_ref())
|
||||||
.split(chunk);
|
.split(chunk);
|
||||||
|
|
||||||
let directory = Paragraph::new(Text::from(Span::raw(format!("{}", history.history.cwd,))))
|
let directory = Paragraph::new(Text::from(Span::raw(history.history.cwd.to_string())))
|
||||||
.style(Style::default().bg(Color::White).fg(Color::Black));
|
.style(Style::default().bg(Color::White).fg(Color::Black));
|
||||||
|
|
||||||
let count = Paragraph::new(Text::from(Span::raw(format!("x{}", history.count,))))
|
let count = Paragraph::new(Text::from(Span::raw(format!("x{}", history.count,))))
|
||||||
|
Loading…
Reference in New Issue
Block a user