mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
preset apps
This commit is contained in:
parent
fdcb8de4f2
commit
3d6615c528
3 changed files with 15 additions and 1 deletions
|
|
@ -130,6 +130,11 @@ in {
|
|||
type = types.str;
|
||||
description = "Name of the preset";
|
||||
};
|
||||
apps = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Apps to enable when the preset is enabled";
|
||||
default = [];
|
||||
};
|
||||
commands = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Commands to run post setup when the preset is enabled";
|
||||
|
|
|
|||
|
|
@ -208,5 +208,8 @@ impl HazeConfig {
|
|||
#[derive(Default, Deserialize, Debug)]
|
||||
pub struct Preset {
|
||||
pub name: String,
|
||||
#[serde(default)]
|
||||
pub apps: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub commands: Vec<String>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,6 +234,12 @@ impl ServiceTrait for PresetService {
|
|||
) -> Result<Vec<String>> {
|
||||
let preset =
|
||||
get_preset(&config.preset, &self.0).ok_or_else(|| Report::msg("invalid preset"))?;
|
||||
Ok(preset.commands.clone())
|
||||
let mut commands: Vec<_> = preset
|
||||
.apps
|
||||
.iter()
|
||||
.map(|app| format!("occ app:enable {app} --force"))
|
||||
.collect();
|
||||
commands.extend_from_slice(&preset.commands);
|
||||
Ok(commands)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue