-
Notifications
You must be signed in to change notification settings - Fork 486
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
Manage adding/updating git repos through chezmoi #662
Comments
Thank you @johnw188 for this really clear and well thought through feature request :) This is a really good idea. I'm in a similar position, and have similar (but not identical) scripts to handle populating directories from tarballs downloaded from a URL and unpacked. I think chezmoi should have a feature like you suggest. A few thoughts off the top of my head:
Indeed! I think that your feature request would simplify common workflows for many chezmoi users. Thank you very much for your offer of implementing this feature. I'm very happy to receive contributions :) Right now I'm in the process of re-working the core of chezmoi in #654 for a version two release that will have quite an impact on the code, but please don't hold back in submitting a PR. |
Do you think that recursion is necessary? I know for For example, if I had a tarball extracted to If on the other hand there needed to be a file in the root of the repo called My initial thoughts on command layout would be something like:
|
Thanks, I did not know that we could avoid recursion here, and doing so would definitely makes things simpler. I would also add that there is (probably) a clear and understandable algorithm here: clean out everything from the root My inclination towards a
Your proposal for a I realize that you're using Thanks again - you're leading something good here :) |
Another thought: The command and the configuration file should have consistent names. If the command is |
Strong agree here, I figure
I'll probably have some time this next week to poke at this. Is your work in #654 going to affect how commands are added and source is laid out? This feature seems pretty minor as all the heavy lifting is sitting on top of |
That all sounds good. Bikeshedding a little, I'd drop the column headers from the #654 will affect the internals, but not anything externally visible to users (apart from fixing a couple of subtle bugs and enabling some new functionality). I think it's worth you starting on |
Is your feature request related to a problem? Please describe.
I've been setting up my dotfiles and I have found a super common pattern is writing a script called
updateX.sh
, which basically looks like this:I would like to deal with this common situation inside the tool that I am using to manage the dotfiles
Describe the solution you'd like
I like having all of my files in a single repo and hate dealing with git submodules. I would like to be able to do a
chezmoi update-packaged-files
or something similar to download from external sources, unpack into the right place, then clean up the archives and add to chezmoi.One solution I could see would be a new special filetype inside the chezmoi filesystem called, say,
chezmoi_data_source
, containing a URL to an archive. This way thechezmoi add-remote-archive [target dir]
would just interact with creating this file and another command could do the work of deleting everything apart fromchezmoi_data_source
, unpacking into the target dir, and doing an add of the content. This way the link to the remote source is recorded.There would be no nesting support - for an update all command it would stop digging down the directory structure when it hit a
chezmoi_data_source
file. Data sources would only be allowed and processed in subdirectories.For github specifically there could be a special case of github repo url -> tarball from master.
Describe alternatives you've considered
The scripting solution I am using needs to be made more generic, and I figured if I was going to make it more generic it would be nice to have it be a core part of the tooling. This would also help with the docs for things like
oh-my-zsh
Additional context
I am proficient in golang and could probably implement this feature. I would like to know if it's something you'd be interested in collaborating on, if not I will just go build my generalized script and be done with it.
The text was updated successfully, but these errors were encountered: