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

feature: Allow providing rc file #392

Merged
merged 4 commits into from Dec 5, 2022

Conversation

mrexox
Copy link
Member

@mrexox mrexox commented Dec 4, 2022

Closes #185 #178 #99 #253 #249

⚡ Summary

  • Add rc global option which allows to set the ENVs file

Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
@mrexox mrexox requested a review from skryukov December 4, 2022 09:27
Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
@mrexox mrexox marked this pull request as ready for review December 4, 2022 09:30
@mrexox mrexox changed the title Allow providing rc file feature: Allow providing rc file Dec 5, 2022
@mrexox mrexox merged commit 46c7e9b into evilmartians:master Dec 5, 2022
@mrexox mrexox deleted the feature/allow-providing-rc-file branch December 5, 2022 12:41
@PikachuEXE
Copy link
Contributor

One issue
The generated code in hook looks like this

set -a
[ -f '~/.lefthookrc' ] && source '~/.lefthookrc'

However ~ would NOT be resolved to $HOME

I tested with more variants:

# works
[ -f "$HOME/.lefthookrc" ] && echo "$HOME/.lefthookrc exists"
# nope
[ -f '$HOME/.lefthookrc' ] && echo '$HOME/.lefthookrc exists'
[ -f '~/.lefthookrc' ] && echo '~/.lefthookrc exists'
# Original generated one
[ -f '~/.lefthookrc' ] && source '~/.lefthookrc'

My current workaround is to put absolute path in rc:

# See following doc for details
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md#rc

# You can choose whatever name you want.
# You can share it between projects where you use lefthook.
# Make sure the path is absolute.
rc: /Users/username/.lefthookrc

If this would be fixed then the doc can remain unchanged
If not the doc should be updated to not use ~/.lefthookrc

@mrexox
Copy link
Member Author

mrexox commented Dec 14, 2022

Hey @PikachuEXE! You are right, I missed that thing. Although I still feel like having able to set ~ or $HOME would be better, so I'll just remove quoting in a template.

mrexox added a commit that referenced this pull request Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants