aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle/src/command/client/init/powershell.rs
blob: 8deb9a3b7704df07e3bb5a56982634ae84a65ad5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use crate::atuin_client::settings::Tmux;

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

    let (bind_ctrl_r, bind_up_arrow) = if std::env::var("ATUIN_NOBIND").is_ok() {
        (false, false)
    } else {
        (!disable_ctrl_r, !disable_up_arrow)
    };

    // TODO: tmux popup for Powershell
    println!("{base}");
    println!(
        "Enable-AtuinSearchKeys -CtrlR {} -UpArrow {}",
        ps_bool(bind_ctrl_r),
        ps_bool(bind_up_arrow)
    );
}

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