Update config section readme. Fix skipconfirmation not working with config

This commit is contained in:
Jeevitha Kannan K S 2024-11-30 18:55:07 +05:30
parent 15c40d1297
commit 8d536f02e0
No known key found for this signature in database
GPG Key ID: 5904C34A2F7CE333
2 changed files with 22 additions and 18 deletions

View File

@ -107,7 +107,9 @@ Note that crates installed using `cargo install` require manual updating with `c
Linutil supports configuration through a TOML config file. Path to the file can be specified with `--config` (or `-c`). Linutil supports configuration through a TOML config file. Path to the file can be specified with `--config` (or `-c`).
Available options: Available options:
- `auto_execute` - a list of commands to execute automatically (can be combined with `--skip-confirmation`) - `auto_execute` - A list of commands to execute automatically (can be combined with `--skip-confirmation`)
- `skip_confirmation` - Boolean ( Equal to `--skip-confirmation`)
- `size_bypass` - Boolean ( Equal to `--size-bypass` )
Example config: Example config:
```toml ```toml
@ -118,6 +120,9 @@ auto_execute = [
"Alacritty", "Alacritty",
"Kitty" "Kitty"
] ]
skip_confirmation = true
size_bypass = true
``` ```
```bash ```bash

View File

@ -155,6 +155,9 @@ impl AppState {
} }
fn spawn_confirmprompt(&mut self) { fn spawn_confirmprompt(&mut self) {
if self.skip_confirmation {
self.handle_confirm_command();
} else {
let cmd_names: Vec<_> = self let cmd_names: Vec<_> = self
.selected_commands .selected_commands
.iter() .iter()
@ -168,6 +171,7 @@ impl AppState {
CONFIRM_PROMPT_FLOAT_SIZE, CONFIRM_PROMPT_FLOAT_SIZE,
)); ));
} }
}
fn get_list_item_shortcut(&self) -> Box<[Shortcut]> { fn get_list_item_shortcut(&self) -> Box<[Shortcut]> {
if self.selected_item_is_dir() { if self.selected_item_is_dir() {
@ -795,13 +799,8 @@ impl AppState {
self.selected_commands.push(node); self.selected_commands.push(node);
} }
} }
if self.skip_confirmation {
self.handle_confirm_command();
} else {
self.spawn_confirmprompt(); self.spawn_confirmprompt();
} }
}
SelectedItem::None => {} SelectedItem::None => {}
} }
} }