Replies: 11 comments 5 replies
-
The syntax of chezmoi already has opt-in dotfile management: run |
Beta Was this translation helpful? Give feedback.
-
@twpayne I could be wrong, but I think "opt-in" in this instance is referring to That said, wouldn't the example above work if it was
instead? |
Beta Was this translation helpful? Give feedback.
-
For clarity, I only want configuration to be applied when the corresponding binary is installed on the system. So, for example:
Having something like this would mean I can just install a new package, run
This does exactly what I need. Thank you. |
Beta Was this translation helpful? Give feedback.
-
@ja1den While that might be true right now, I don't think it's entirely correct. @twpayne Does this look as expected to you? ❯ tree $(chezmoi source-path) /F
.
│ .chezmoi.toml.tmpl
│ .chezmoiignore
├──.chezmoitemplates
│ └──powershell
│ profile.ps1
├──Documents
│ ├──PowerShell
│ │ Microsoft.PowerShell_profile.ps1.tmpl
│ └──WindowsPowerShell
│ Microsoft.PowerShell_profile.ps1.tmpl
└──private_dot_config
├──powershell
│ Microsoft.PowerShell_profile.ps1.tmpl
└──scoop
modify_config.json.ps1.tmpl
❯ Get-Content "$(chezmoi source-path)/.chezmoiignore"
**
{{ if eq .chezmoi.os "windows" }}
!Documents/**
!.config/scoop/**
{{ end }}
❯ chezmoi managed
Documents
Documents/PowerShell
Documents/PowerShell/Microsoft.PowerShell_profile.ps1
Documents/WindowsPowerShell
Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1
❯ chezmoi ignored
.config It also doesn't work with |
Beta Was this translation helpful? Give feedback.
-
Does the following work for you?
|
Beta Was this translation helpful? Give feedback.
-
I've noticed that while Here's what I have at the moment.
My system has Here's what I'm seeing:
From what I can tell,
|
Beta Was this translation helpful? Give feedback.
-
Thinking more, I believe this could be resolved by making it so Thus, there would be three possibilities for how a file is managed:
This would also fix the fact that |
Beta Was this translation helpful? Give feedback.
-
I don’t think that will work for my usage of I’m going to shift this from an issue to a discussion thread. |
Beta Was this translation helpful? Give feedback.
-
I wonder if there might either be (a) special syntax in With respect to special syntax, I see a couple of possibilities. The first would be inline like
If unspecified, it would be the same as The second possibility is to have some sort of directives that change the interpretation mode.
Of those, I prefer the directive approach. The other option is to maintain full backwards compatibility with the existing
|
Beta Was this translation helpful? Give feedback.
-
This could work, but it might be cleaner to have it as a global configuration option, something like Alternatively, instead of having a directory, simply search for |
Beta Was this translation helpful? Give feedback.
-
I've switched my repository to use Thank you for your help. |
Beta Was this translation helpful? Give feedback.
-
Description
.chezmoiignore
doesn't distinguish between!*
and!*/
.The former should exclude all files, while the latter should only exclude directories.
Currently, both are treated as excluding all files.
This comes from the SO link in #261, which links to this answer that explains it more clearly.
Steps to Reproduce
Create a file
.chezmoignore
with the following content:Running
chezmoi managed
should return no results (i.e., be empty).Currently, it will return all possible results (i.e., the
*
and the!*/
lines cancel out).Additional context
I need this to work in order to set up opt-in dotfile management, rather than opt-out.
The ideal workflow would be as follows:
By default, no files will be managed, preventing unnecessary configuration from being copied / templated.
To opt-in to managing a file, add a corresponding line to the
.chezmoignore
.Running
chezmoi managed
should return.bashrc
and.config/starship.toml
(assuming both exist).Beta Was this translation helpful? Give feedback.
All reactions