feat(chezmoi): add exclude_encrypted config (#1453)
Co-authored-by: Gideon <87426140+GideonBear@users.noreply.github.com>
This commit is contained in:
@@ -165,6 +165,13 @@ pub struct Deno {
|
||||
version: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub struct Chezmoi {
|
||||
exclude_encrypted: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
@@ -457,6 +464,9 @@ pub struct ConfigFile {
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
npm: Option<NPM>,
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
chezmoi: Option<Chezmoi>,
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
yarn: Option<Yarn>,
|
||||
|
||||
@@ -1774,6 +1784,14 @@ impl Config {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn chezmoi_exclude_encrypted(&self) -> bool {
|
||||
self.config_file
|
||||
.chezmoi
|
||||
.as_ref()
|
||||
.and_then(|chezmoi| chezmoi.exclude_encrypted)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn vscode_profile(&self) -> Option<&str> {
|
||||
let vscode_cfg = self.config_file.vscode.as_ref()?;
|
||||
let profile = vscode_cfg.profile.as_ref()?;
|
||||
|
||||
@@ -916,9 +916,17 @@ pub fn run_chezmoi_update(ctx: &ExecutionContext) -> Result<()> {
|
||||
let chezmoi = require("chezmoi")?;
|
||||
HOME_DIR.join(".local/share/chezmoi").require()?;
|
||||
|
||||
let mut cmd = ctx.execute(chezmoi);
|
||||
|
||||
print_separator("chezmoi");
|
||||
|
||||
ctx.execute(chezmoi).arg("update").status_checked()
|
||||
cmd.arg("update");
|
||||
|
||||
if ctx.config().chezmoi_exclude_encrypted() {
|
||||
cmd.arg("--exclude=encrypted");
|
||||
}
|
||||
|
||||
cmd.status_checked()
|
||||
}
|
||||
|
||||
pub fn run_myrepos_update(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user