-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add read-source-state hook #3343
Conversation
Seems like a potentially powerful change, as you say. |
5f8af38
to
9611207
Compare
@bradenhilton @nandalopes @felipecrs I would appreciate your input on this. |
I will carefully analyze and provide my feedback in some hours. |
No stress felipecrs and @halostatue I didn't mention because you're already in the conversation :) |
I believe this is a nice change. It will also be useful to install tools required by |
The code and documentation looks good. I think my main concern is that the commands need to be specified "full path". I'm not sure that there's a good workaround for this. |
Would the password manager part benefit from being more general instead? A password manager is just one of many potential prerequisites as @felipecrs pointed out. Either way, this is great. |
9611207
to
c4a95aa
Compare
Thank you all for the reviews!
Good point. It would be nice if the path to the One way I can think of doing this is by overriding the command (i.e. first checking for the command relative to the source state directory, and only afterwards falling back to the user's $PATH), but this falls foul of chezmoi's "the source state consists of only regular files and directories" principle as it would require the hook command to be executable in the source state. Another way would be to use an explicit interpreter, something like: [hooks.read-source-state.pre]
command = "sh"
args = ["-c", ".local/share/chezmoi/.install-password-manager.sh"] Thoughts?
Yes, absolutely! I used the password manager example as it's a problem that I personally have (on a new machine I need to install and setup 1Password before I can deploy my dotfiles). It would be great to have some more examples of adding prerequisites. |
Refs #3342.
Work in progress. Small code change, big impact. Feedback appreciated.