TheLocehiliosan / yadm

Yet Another Dotfiles Manager
https://yadm.io/
GNU General Public License v3.0
4.92k stars 176 forks source link

Find untracked files #416

Closed gwww closed 2 years ago

gwww commented 2 years ago

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

I find that I often create new files and forget to track them. Because yadm use a bare git repo, using the git untracked feature is not useful.

I wrote a script to suss out such files. I'm not sure you want to consider this a feature request as such, but it I'd be happy if this feature in some way made it into yadm. Others may find the script useful.

Describe the solution you'd like

This script is useful to me and solves the problem I mention above.

https://github.com/gwww/dotfiles/blob/main/bin/yadm-untracked

Describe alternatives you've considered

I will consider if there is an appropriate hook to connect my script into, although my first reaction is this is something I want to run separately from a "standard" yadm command.

TheLocehiliosan commented 2 years ago

yadm is distributed with a set of contributed code, which is not part of yadm directly, but useful to yadm users.

If you want to create a PR which adds a "contrib/commands" directly, and includes this script I think I would include it.

A few things to consider.

This script looks like it uses $HOME, while yadm might be using a different directory depending on how someone initializes it. You might consider using something like yadm enter to either wrap the script, or from within the script to gain access to the $GIT_WORK_TREE variable. Like this:

yadm enter printf '$GIT_WORK_TREE\\n'

Might be good to include instructions on configuring a yadm-specific alias. Like this:

yadm gitconfig alias.untracked '!<PATH-TO-SCRIPT>'

Then the script could be invoked via yadm untracked from wherever...

gwww commented 2 years ago

Thanks! I have updated the script and will create a PR. Should I place the script in contrib or would you like a subdirectory off of contrib?

TheLocehiliosan commented 2 years ago

I was thinking of contrib/commands

TheLocehiliosan commented 2 years ago

The PR related to this command has been merged into develop. It will be included with the next version.