Skip to content
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 related files by logical group #3698

Closed
mjkx5 opened this issue Apr 17, 2024 · 5 comments
Closed

Manage related files by logical group #3698

mjkx5 opened this issue Apr 17, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@mjkx5
Copy link

mjkx5 commented Apr 17, 2024

Is your feature request related to a problem? Please describe.

I do not know how to fastly find history about any package file, eg: bat, htop ... .

Describe the solution you'd like

maybe add package_name to specify domain about directory or file.
chezmoi package_add package_name file_or_directory # specify package when add file or package
chezmoi package_search package_name # only search history about that package
chezmoi package_list_directory package_name # list package_name's directory or files

@mjkx5 mjkx5 added the enhancement New feature or request label Apr 17, 2024
@halostatue
Copy link
Collaborator

This is an interesting idea (using chezmoi state to be able to track which files belong to which packages), but I’m not sure that it fits within the scope of what chezmoi does.

I don't think that using chezmoi state is the right way to do this (if the state file goes away, chezmoi can reconstruct it by reapplying everything, but this data would be permanently lost). This might be something that could be added for #2673 via something like #2273, because additional attributes could be added.

If we reframe this from package to group, then with such metadata, one could potentially do chezmoi apply --group vim to do a filtered apply only to files within the vim group.

@halostatue halostatue changed the title use package name cmd to manager config Manage related files by logical group Apr 17, 2024
@twpayne
Copy link
Owner

twpayne commented Apr 17, 2024

The fundamental problem of splitting things into separate groups is that it assumes that it is possible to split things into separate groups. For example, is the part of your vim configuration for editing .gitignore files part of your vim config, part of your git config, both, or neither?

For this reason, chezmoi has deliberately avoided any kind of grouping.

@twpayne twpayne closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
@mjkx5
Copy link
Author

mjkx5 commented Apr 18, 2024

I know your meaning, although I think .gitignore belonging to current directory package.

chezmoi managed --include=dirs will list all managed dirs, but It is so unintuitive.

.config/Kvantum
.config/Kvantum/Catppuccin-Latte
.config/Kvantum/Catppuccin-Mocha
.config/hypr
.config/hypr/UserConfigs
.config/hypr/UserScripts
.config/hypr/configs
.config/hypr/scripts

In my opinion, It's two package, Kvantum, hypr package. It is intuitive and clear.

In package inner, search directory using directory . eg: Kvantum :

$ chezmoi package_search_dir Kvantum
.config/Kvantum
.config/Kvantum/Catppuccin-Latte
.config/Kvantum/Catppuccin-Mocha

@twpayne
Copy link
Owner

twpayne commented Apr 18, 2024

You can tell chezmoi to only consider specific directories, for example:

chezmoi apply ~/.config/Kvantum

will only make changes to ~/.config/Kvantum.

If you want to see the history for this directory, you can use:

chezmoi git -- log $(chezmoi source-path ~/.config/Kvantum)

What other functionality do you need?

@mjkx5
Copy link
Author

mjkx5 commented Apr 19, 2024

@twpayne It's awesome. thanks

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants