twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
12.85k stars 477 forks source link

Flag to show full path on `chezmoi managed` #2614

Closed nekowinston closed 1 year ago

nekowinston commented 1 year ago

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

I would like to search all my chezmoi managed files easily with tools like ripgrep:

chezmoi managed -x encrypted -i files | xargs rg -i PATTERN

Since managed only returns .config for ~/.config, this command only works when invoked with the CWD set to $HOME.

Describe the solution you'd like

A flag for managed (or possibly use verbose) to show the full path for each file.

Describe alternatives you've considered

Using awk like:

chezmoi managed -x encrypted -i files | awk '{ printf("%s/%s\n", ENVIRON["HOME"], $0) }' | xargs rg -i PATTERN

Since the xargs usage already impacts performance and introduces a dependency, a new flag for managed would be far better. There is a feature request for --files-from on ripgrep, but for now, xargs seems to be needed for such a function.

Additional context

I would love to search all my chezmoi-managed files in a custom Telescope picker. 🙂

And also many thanks for your work on chezmoi. ❤️

twpayne commented 1 year ago

Good idea. Implemented in #2617. Note that --path-style=absolute can be abbreviated to -p a.