Closed MasonFI closed 8 months ago
Hello, @MasonFI,
If you wish to run a csx
script using dotnet husky exec
, you can access the first argument with Args[0]
.However, the example in the documentation demonstrates the use of the commit-msg
hook, which redirects $1
to the csx
script. To access the temporary commit message file in Git, you should use Args[0][0]
.
Depending on your intended purpose, both approaches are valid.
remember to test the commit-msg hook, you need to pass the temporary commit message file path to the csx script, not the commit message. (this is related to how git works internally, it creates a file containing your commit message before actual commit)
Thanks for your answer, you are correct. My mistake, I understood the concept wrongly.
Version
0.6.2
Details
I followed the guide and when running dotnet husky exex ..husky\csx\commit-lint.csx --args "something here" I get error message saying "Unable to execute cached script".
I then changed the line "private var msg = File.ReadAllLines(Args[0])[0];" to private var msg = Args[0]; and it runs fine
Am I missing something here, is the guide incomplete or what?
Steps to reproduce