Skip to content

Commit

Permalink
feat: initial support for Swift Plugins (#556)
Browse files Browse the repository at this point in the history
Co-authored-by: Valentin Kiselev <[email protected]>
  • Loading branch information
csjones and mrexox authored Sep 25, 2023
1 parent b67182f commit 42bdb19
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ version:
@read -p "New version: " version
sed -i "s/const version = .*/const version = \"$$version\"/" internal/version/version.go
sed -i "s/VERSION := .*/VERSION := $$version/" packaging/Makefile
sed -i "s/lefthook-plugin.git\", exact: \".*\"/lefthook-plugin.git\", exact: \"$$version\"/" docs/install.md
make -C packaging clean set-version
git add internal/version/version.go packaging/*
git add internal/version/version.go packaging/* docs/install.md
9 changes: 9 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Choose your fighter:
- [Node.js](#node)
- [Go](#go)
- [Python](#python)
- [Swift](#swift)
- [Scoop](#scoop)
- [Homebrew](#homebrew)
- [Winget](#winget)
Expand Down Expand Up @@ -70,6 +71,14 @@ You can find Python wrapper here [package](https://github.com/life4/lefthook)
python3 -m pip install --user lefthook
```

## <a id="swift"></a> Swift

You can find the Swift wrapper plugin [here](https://github.com/csjones/lefthook-plugin). To utilize lefthook, include the plugin in the dependencies section of your `Package.swift`:

```swift
.package(url: "https://github.com/csjones/lefthook-plugin.git", exact: "1.5.0"),
```

## <a id="scoop"></a> Scoop for Windowss

```sh
Expand Down
3 changes: 3 additions & 0 deletions internal/templates/hook.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ call_lefthook()
elif command -v npx >/dev/null 2>&1
then
npx @evilmartians/lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook $@
else
echo "Can't find lefthook in PATH"
{{- if .AssertLefthookInstalled}}
Expand Down

0 comments on commit 42bdb19

Please sign in to comment.