From 88f3e2a04fcf10a1b44aaf30c91f38393b5cfeda Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Fri, 20 Oct 2023 07:16:54 +0100 Subject: Add enter_accept to immediately execute an accepted command (#1311) * make enter execute the command, tab copy it * Add config for enter_accept enter_accept will make Atuin immediately accept an execute a command when selected. It defaults to false in our binary, but the default config enables it. This means that users who already use atuin will not default to the new behaviour unless they opt in, but new users will have it by default. Thanks to @davidhewitt for the patch and bulk of this implementation! Currently we have it just for zsh, but I'll follow up with other shells (unless anyone beats me to it :D) * Add docs * we need to tidy up the ui code anyway * Check if using zsh * Update docs/docs/config/config.md Co-authored-by: Conrad Ludgate --------- Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Co-authored-by: Conrad Ludgate --- atuin-client/src/settings.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'atuin-client/src') diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index 15aa9e06..fca76004 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -179,6 +179,7 @@ pub struct Settings { pub network_connect_timeout: u64, pub network_timeout: u64, + pub enter_accept: bool, // This is automatically loaded when settings is created. Do not set in // config! Keep secrets and settings apart. @@ -378,6 +379,12 @@ impl Settings { .set_default("secrets_filter", true)? .set_default("network_connect_timeout", 5)? .set_default("network_timeout", 30)? + // enter_accept defaults to false here, but true in the default config file. The dissonance is + // intentional! + // Existing users will get the default "False", so we don't mess with any potential + // muscle memory. + // New users will get the new default, that is more similar to what they are used to. + .set_default("enter_accept", false)? .add_source( Environment::with_prefix("atuin") .prefix_separator("_") @@ -391,6 +398,7 @@ impl Settings { create_dir_all(&config_dir) .wrap_err_with(|| format!("could not create dir {config_dir:?}"))?; + create_dir_all(&data_dir).wrap_err_with(|| format!("could not create dir {data_dir:?}"))?; let mut config_file = if let Ok(p) = std::env::var("ATUIN_CONFIG_DIR") { -- cgit v1.3.1