Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanamura/captain
makes easy to manage git hooks for written in Swift products
https://github.com/yanamura/captain
git git-hook hooks precommit precommit-hooks swift swift-package-manager
Last synced: 2 months ago
JSON representation
makes easy to manage git hooks for written in Swift products
- Host: GitHub
- URL: https://github.com/yanamura/captain
- Owner: yanamura
- License: mit
- Created: 2018-04-01T12:48:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-27T14:33:23.000Z (almost 4 years ago)
- Last Synced: 2024-10-13T01:34:33.833Z (3 months ago)
- Topics: git, git-hook, hooks, precommit, precommit-hooks, swift, swift-package-manager
- Language: Swift
- Homepage:
- Size: 36.1 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Captain
Captain makes easy to manage git hooks
## Install
### Using Mint
if you want to install globally, use [Mint](https://github.com/yonaskolb/Mint)
```
$ mint install yanamura/Captain
```
### Using SwiftPackageManager
```
/// Package.swift
dependencies: [
...
.package(url: "https://github.com/yanamura/Captain"),
]
``````
$ swift build --package-path -c release
```executable binary will be created to ./build/release/captain
## Usage
### Configuration
create `.captain` onproject root directory.```
/ProjectDir
/.git
.gitignore
.captain
```
.git directory and .captain file should be in same location.#### .captain
```
{
"pre-commit": "swift-format -r Sources -i"
}
```or
```
{
"pre-commit": [
"swift-format -r Sources -i",
"git add ."
]
}
```#### supported hooks
- applypatch-msg
- pre-applypatch
- post-applypatch
- pre-commit
- prepare-commit-msg
- commit-msg
- post-commit
- pre-rebase
- post-checkout
- post-merge
- pre-push
- pre-receive
- update
- post-receive
- post-update
- push-to-checkout
- pre-auto-gc
- post-rewrite
- sendemail-validat### Set Git Hooks
```
$ captain install
```### Using Swift Package Manager
```
/// Package.swift
dependencies: [
...
.package(url: "https://github.com/yanamura/Captain"),
]
``````
$ swift run --package-path -c release captain install
```#### Using [Mint](https://github.com/yonaskolb/Mint)
```
$ mint run yanamura/Captain captain install
```### Unset Git Hooks
```
$ captain uninstall
```