feat(chezmoi): add exclude_encrypted config (#1453)
Co-authored-by: Gideon <87426140+GideonBear@users.noreply.github.com>
This commit is contained in:
@@ -286,6 +286,11 @@
|
|||||||
# winget_use_sudo = true
|
# winget_use_sudo = true
|
||||||
|
|
||||||
|
|
||||||
|
[chezmoi]
|
||||||
|
# Exclude encrypted files from update
|
||||||
|
# (default: false)
|
||||||
|
# exclude_encrypted = false
|
||||||
|
|
||||||
[npm]
|
[npm]
|
||||||
# Use sudo if the NPM directory isn't owned by the current user
|
# Use sudo if the NPM directory isn't owned by the current user
|
||||||
# use_sudo = true
|
# use_sudo = true
|
||||||
|
|||||||
@@ -165,6 +165,13 @@ pub struct Deno {
|
|||||||
version: Option<String>,
|
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)]
|
#[derive(Deserialize, Default, Debug, Merge)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
#[allow(clippy::upper_case_acronyms)]
|
#[allow(clippy::upper_case_acronyms)]
|
||||||
@@ -457,6 +464,9 @@ pub struct ConfigFile {
|
|||||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||||
npm: Option<NPM>,
|
npm: Option<NPM>,
|
||||||
|
|
||||||
|
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||||
|
chezmoi: Option<Chezmoi>,
|
||||||
|
|
||||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||||
yarn: Option<Yarn>,
|
yarn: Option<Yarn>,
|
||||||
|
|
||||||
@@ -1774,6 +1784,14 @@ impl Config {
|
|||||||
.unwrap_or(false)
|
.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> {
|
pub fn vscode_profile(&self) -> Option<&str> {
|
||||||
let vscode_cfg = self.config_file.vscode.as_ref()?;
|
let vscode_cfg = self.config_file.vscode.as_ref()?;
|
||||||
let profile = vscode_cfg.profile.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")?;
|
let chezmoi = require("chezmoi")?;
|
||||||
HOME_DIR.join(".local/share/chezmoi").require()?;
|
HOME_DIR.join(".local/share/chezmoi").require()?;
|
||||||
|
|
||||||
|
let mut cmd = ctx.execute(chezmoi);
|
||||||
|
|
||||||
print_separator("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<()> {
|
pub fn run_myrepos_update(ctx: &ExecutionContext) -> Result<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user