izqui / todos

Get the TODO's in your code directly into Github Issues
70 stars 6 forks source link

Check if `todos` is available #46

Open esttorhe opened 9 years ago

esttorhe commented 9 years ago

I followed the instructions and had to actually tweak your precommit-hook because it wouldn't work on Github GUI clients (will paste the code at the end of this issue if you want to add it just in case).

Everything works great but I'm wondering how it will behave with a team of multiple devs; cloning the repo and then trying to do commits the commit will fail because todos won't be installed on their machines.

Perhaps making a quick check before executing the command would be a good idea.


On the other hand here's the modified hook that's working on GUI Github clients (ignore the fact that i'm using zsh instead of bash; has nothing to do with the fix):

#!/bin/zsh
PATH=/usr/local/opt/go/bin:$PATH
git diff --cached --name-only | todos work

The fix is required because GUI doesn't have access (or normally don't access PATH) and thus it doesn't read GOPATH and fails to find the bin where the downloaded packages are stored

izqui commented 9 years ago

I don't use any GUI Git clients, so it would be really helpful if you could make the fix and submit a PR, because I really don't see how could I help, sorry.

Thanks for the interest though

esttorhe commented 9 years ago

@izqui like I said; the issue is nothing related to the gui bug; I just mentioned it because I ran into that issue.

I'm just opening this issue in the hopes that perhaps the pre commit hook could check if the tool is installed before trying to run it (for the aforementioned scenario I described of multiple devs in a team)

izqui commented 9 years ago

I thought git hooks weren't synced with the repository and only stayed locally.

I haven't done much Bash programming, do you think this would work?

if ! type "$foobar_command_name" > /dev/null; then
  # install foobar here
fi