Compare commits

...

3 Commits

Author SHA1 Message Date
JEEVITHA KANNAN K S
73891aa260
Merge a5e24a7148 into 696110eae5 2024-10-26 08:46:55 +05:30
Adam Perkowski
696110eae5
refact(release): better categories (#876) 2024-10-25 15:44:41 -05:00
Jeevitha Kannan K S
a5e24a7148
feat: Add --skip-confirmation flag 2024-10-15 22:18:37 +05:30
3 changed files with 32 additions and 17 deletions

19
.github/release.yml vendored
View File

@ -1,20 +1,23 @@
changelog:
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
label: 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
label: 'bug'
- title: '⚙️ Refactoring'
label: 'refactor'
- title: '🧩 UI/UX'
label: 'UI/UX'
- title: '📚 Documentation'
label: 'documentation'
- title: '🔒 Security'
label: 'security'
- title: '🧰 GitHub Actions'
label: 'github actions'
label: 'github_actions'
- title: '🦀 Rust'
label: 'rust'
- title: '📃 Scripting'
label: 'script'
exclude:
labels:
- 'skip-changelog'

View File

@ -30,6 +30,12 @@ struct Args {
#[arg(default_value_t = Theme::Default)]
#[arg(help = "Set the theme to use in the application")]
theme: Theme,
#[arg(
short = 'y',
long,
help = "Skip confirmation prompt before executing commands"
)]
skip_confirmation: bool,
#[arg(long, default_value_t = false)]
#[clap(help = "Show all available options, disregarding compatibility checks (UNSAFE)")]
override_validation: bool,
@ -38,7 +44,7 @@ struct Args {
fn main() -> io::Result<()> {
let args = Args::parse();
let mut state = AppState::new(args.theme, args.override_validation);
let mut state = AppState::new(args.theme, args.override_validation, args.skip_confirmation);
stdout().execute(EnterAlternateScreen)?;
enable_raw_mode()?;

View File

@ -62,6 +62,7 @@ pub struct AppState {
drawable: bool,
#[cfg(feature = "tips")]
tip: &'static str,
skip_confirmation: bool,
}
pub enum Focus {
@ -79,7 +80,7 @@ pub struct ListEntry {
}
impl AppState {
pub fn new(theme: Theme, override_validation: bool) -> Self {
pub fn new(theme: Theme, override_validation: bool, skip_confirmation: bool) -> Self {
let (temp_dir, tabs) = linutil_core::get_tabs(!override_validation);
let root_id = tabs[0].tree.root().id();
@ -97,6 +98,7 @@ impl AppState {
drawable: false,
#[cfg(feature = "tips")]
tip: get_random_tip(),
skip_confirmation,
};
state.update_items();
@ -681,14 +683,18 @@ impl AppState {
}
}
let cmd_names = self
.selected_commands
.iter()
.map(|node| node.name.as_str())
.collect::<Vec<_>>();
if self.skip_confirmation {
self.handle_confirm_command();
} else {
let cmd_names = self
.selected_commands
.iter()
.map(|node| node.name.as_str())
.collect::<Vec<_>>();
let prompt = ConfirmPrompt::new(&cmd_names[..]);
self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40));
let prompt = ConfirmPrompt::new(&cmd_names[..]);
self.focus = Focus::ConfirmationPrompt(Float::new(Box::new(prompt), 40, 40));
}
} else {
self.go_to_selected_dir();
}