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

feat: add support for exit on HUSKY = false #33

Closed Xemrox closed 2 years ago

Xemrox commented 2 years ago

Description

Add support for skipping husky execution on $HUSKY="false". Implements #32

Type of change

Checklist

alirezanet commented 2 years ago

Cool, thanks 💐

alirezanet commented 2 years ago

I forgot to mention with this change we also need to update the AttachCommand:

   private static string GetCondition(XContainer doc)
   {
      var condition = "'$(HUSKY)' != 0";
      var targetFrameworks = doc.Descendants("PropertyGroup").Descendants("TargetFrameworks").FirstOrDefault();
      if (targetFrameworks != null && targetFrameworks.Value.Contains(';')) condition += " and '$(IsCrossTargetingBuild)' == 'true'";

      return condition;
   }