Skip to content

Commit

Permalink
feat: add file_path precondition
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevithakannan2 committed Oct 19, 2024
1 parent 79eb752 commit a4965a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/src/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ impl Entry {
SystemDataType::CommandExists => values
.iter()
.all(|command| which::which(command).is_ok() == *matches),
SystemDataType::FileExists => values
.iter()
.all(|path| Path::new(path).exists() == *matches),
}
},
)
Expand All @@ -153,6 +156,8 @@ enum SystemDataType {
File(PathBuf),
#[serde(rename = "command_exists")]
CommandExists,
#[serde(rename = "file_exists")]
FileExists,
}

fn filter_entries(entries: &mut Vec<Entry>) {
Expand Down
5 changes: 5 additions & 0 deletions core/tabs/system-setup/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ description = "This command installs a minimal arch server setup under 5 minutes
script = "arch/server-setup.sh"
task_list = "SI D"

[[data.entries.preconditions]]
matches = true
data = "file_exists"
values = ["/usr/lib/initcpio/hooks/archiso"]

[[data.entries]]
name = "Paru AUR Helper"
description = "Paru is your standard pacman wrapping AUR helper with lots of features and minimal interaction.\nTo know more about AUR helpers visit: https://wiki.archlinux.org/title/AUR_helpers"
Expand Down

0 comments on commit a4965a3

Please sign in to comment.