husky icon indicating copy to clipboard operation
husky copied to clipboard

feat: add env as a variable to give to husky to set the environment it is run in

Open Gentatsu opened this issue 2 years ago • 2 comments

This PR enables users to add as argument to the install script the environment the scripts run in. An example of this is to run in bash instead of sh.

This PR does not include the scope of optional single args, however so it must be provided as a second argument to the dir.

Example usage yarn run prepare .husky bash or apply directly in the prepare section of the package.json

This allows us to specify zsh as well as other shell environments.

Gentatsu avatar Jun 11 '22 21:06 Gentatsu

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 10 '22 23:08 stale[bot]

Bumpy

Gentatsu avatar Aug 10 '22 23:08 Gentatsu

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 10 '22 01:10 stale[bot]

One more bump

Gentatsu avatar Oct 10 '22 08:10 Gentatsu

Thanks for the PR. However, not all shells are available. In particular on Windows. So this feature could create issues for users. For better or worse, sh is one you can expect to work everywhere.

If you're working in a team where the available shells are known beforehand, you can instead have:

# husky/pre-commit
# ...
bash some_script

typicode avatar Dec 13 '22 13:12 typicode