Skip to content

Commit

Permalink
fix: fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrzesniewski committed Jan 12, 2025
1 parent 567ee37 commit cbefeb6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 33 deletions.
1 change: 1 addition & 0 deletions crates/atuin-daemon/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use atuin_client::encryption;
use atuin_client::history::store::HistoryStore;
use atuin_client::record::sqlite_store::SqliteStore;
use atuin_client::settings::Settings;
#[cfg(unix)]
use std::path::PathBuf;
use std::sync::Arc;
use time::OffsetDateTime;
Expand Down
9 changes: 2 additions & 7 deletions crates/atuin/src/command/client/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct Cmd {

#[derive(Clone, Copy, ValueEnum, Debug)]
#[value(rename_all = "lower")]
#[allow(clippy::enum_variant_names, clippy::doc_markdown)]
pub enum Shell {
/// Zsh setup
Zsh,
Expand Down Expand Up @@ -161,13 +162,7 @@ $env.config = (
.await?;
}
Shell::PowerShell => {
powershell::init(
alias_store,
var_store,
self.disable_up_arrow,
self.disable_ctrl_r,
)
.await?;
powershell::init_static(self.disable_up_arrow, self.disable_ctrl_r);
}
}

Expand Down
32 changes: 8 additions & 24 deletions crates/atuin/src/command/client/init/powershell.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
use atuin_dotfiles::store::{var::VarStore, AliasStore};
use eyre::Result;

pub fn init_static(disable_up_arrow: bool, disable_ctrl_r: bool) {
let base = include_str!("../../../shell/atuin.ps1");

Expand All @@ -10,31 +7,18 @@ pub fn init_static(disable_up_arrow: bool, disable_ctrl_r: bool) {
(!disable_ctrl_r, !disable_up_arrow)
};

fn bool(value: bool) -> &'static str {
if value {
"$true"
} else {
"$false"
}
}

println!("{base}");
println!(
"Enable-AtuinSearchKeys -CtrlR {} -UpArrow {}",
bool(bind_ctrl_r),
bool(bind_up_arrow)
ps_bool(bind_ctrl_r),
ps_bool(bind_up_arrow)
);
}

pub async fn init(
_aliases: AliasStore,
_vars: VarStore,
disable_up_arrow: bool,
disable_ctrl_r: bool,
) -> Result<()> {
init_static(disable_up_arrow, disable_ctrl_r);

// dotfiles are not supported yet

Ok(())
fn ps_bool(value: bool) -> &'static str {
if value {
"$true"
} else {
"$false"
}
}
8 changes: 6 additions & 2 deletions crates/atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ use ratatui::{
cursor::SetCursorStyle,
event::{
self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent, KeyModifiers,
KeyboardEnhancementFlags, MouseEvent, PopKeyboardEnhancementFlags,
PushKeyboardEnhancementFlags,
MouseEvent,
},
execute, terminal,
},
Expand All @@ -46,6 +45,11 @@ use ratatui::{
Frame, Terminal, TerminalOptions, Viewport,
};

#[cfg(not(target_os = "windows"))]
use ratatui::crossterm::event::{
KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags,
};

const TAB_TITLES: [&str; 2] = ["Search", "Inspect"];

pub enum InputAction {
Expand Down

0 comments on commit cbefeb6

Please sign in to comment.