alirezanet / Husky.Net

Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
https://alirezanet.github.io/Husky.Net/
MIT License
632 stars 29 forks source link

`${matched}` doesn't work on Windows #15

Closed atifaziz closed 2 years ago

atifaziz commented 2 years ago

Using ${matched} returns an empty list.

To Reproduce

Update task-runner.json to read as follows:

{
   "tasks": [
      {
         "name": "test",
         "command": "bash",
         "args": [ "-c", "echo", "${matched}" ],
         "include": [ "**/*.cs", "**/*.vb" ],
         "windows": {
            "command": "cmd",
            "args": [ "/c", "echo", "${matched}" ]
         }
      }
   ]
}

This is based on the dotnet-format task that comes pre-configured when Husky is installed.

Run the task with:

dotnet husky run --name test

Expected behavior

Expected matching files names to be echoed.

Actual behavior

The task is skipped because no matching files are found:

[Husky] ?? Preparing tasks ...
[Husky] ?? Using task name 'test'
--------------------------------------------------
[Husky] ? Preparing task 'test'
[Husky] ?? Skipped, no matched files
--------------------------------------------------
[Husky] Execution completed ??

I ran this on a Windows 11 machine with a Git repo containing a C# project.

alirezanet commented 2 years ago

Hi, I did a few tests it was working fine in v0.1.1 not sure why it didn't work for you! but I accepted your PR anyway. (your version was much cleaner) image

I don't close this issue until you test again the next version (v0.1.2), to make sure the problem actually is solved or not.

Thank you for your feedback and contribution.

atifaziz commented 2 years ago

I don't close this issue until you test again the next version (v0.1.2), to make sure the problem actually is solved or not.

Worked like a charm after updating to 0.1.2 via dotnet tool update Husky and running the same test. Thanks for merging the fix and your prompt actions!