Skip to content

Commit d3de10b

Browse files
Document how to configure talisman for a single repo
Authored-by: Owen Nelson <[email protected]>
1 parent fcf38be commit d3de10b

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

README.md

+23-28
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
- [Installation](#installation)
1313
- [Install onto path (recommended approach)](#install-onto-path-recommended-approach)
1414
- [Installation as a global hook template](#installation-as-a-global-hook-template)
15-
- [Installation to a single project](#installation-to-a-single-project)
16-
- [Using with hook frameworks](#using-with-hook-frameworks)
17-
- [Pre-commit](#pre-commit)
18-
- [Husky](#husky)
15+
- [Configuring a project](#configuring-a-project)
16+
- [Using with hook frameworks](#using-with-hook-frameworks)
17+
- [Pre-commit](#pre-commit)
18+
- [Husky](#husky)
19+
- [Directly invoking talisman](#directly-invoking-talisman)
1920
- [Upgrading](#upgrading)
2021
- [Talisman in action](#talisman-in-action)
2122
- [Validations](#validations)
@@ -122,38 +123,21 @@ If you choose to set the `$PATH` later, please export TALISMAN\_HOME=$HOME/.tali
122123

123124
- you can set SEARCH_ROOT environment variable with the path of the base directory before executing the installation so you don't need to input it manually during the installation
124125

125-
## Installation to a single project
126+
# Configuring a project
126127

127-
```bash
128-
# Download the talisman installer script
129-
curl https://raw.githubusercontent.com/thoughtworks/talisman/main/install.sh > ~/install-talisman.sh
130-
chmod +x ~/install-talisman.sh
131-
```
132-
133-
```bash
134-
# Install to a single project
135-
cd my-git-project
136-
# as a pre-push hook
137-
~/install-talisman.sh
138-
# or as a pre-commit hook
139-
~/install-talisman.sh pre-commit
140-
```
141-
142-
*Disclaimer: Talisman cannot guarantee its functionality in Microsoft's unsupported versions of Windows. Anyway Talisman is successfully tested on Windows 7 and server 2008 R2, which might not work in future releases.*
143-
144-
# Using with hook frameworks
128+
## Using with hook frameworks
145129

146130
Globally installing talisman as a hook will not clobber any existing hooks. If
147131
the installation script finds any existing hooks, it will only indicate so on
148132
the console. To run multiple hooks we suggest using a hook framework, such as
149133
pre-commit or husky. These instructions assume that the talisman executable is
150134
installed somewhere on your system's path.
151135

152-
## Pre-commit
136+
### Pre-commit
153137

154-
Use [pre-commit](https://pre-commit.com) tool to manage all the existing hooks
155-
along with Talisman. In the suggestion, it will prompt the following code to be
156-
included in .pre-commit-config.yaml:
138+
Use [pre-commit](https://pre-commit.com) to manage existing hooks along with
139+
Talisman. Reference our [pre-commit-hooks](.pre-commit-hooks.yaml) in your
140+
`.pre-commit-config.yaml`:
157141

158142
```yaml
159143
- repo: https://github.com/thoughtworks/talisman
@@ -165,7 +149,7 @@ included in .pre-commit-config.yaml:
165149
entry: cmd --githook pre-commit
166150
```
167151
168-
## Husky
152+
### Husky
169153
170154
[husky](https://typicode.github.io/husky) is an npm module for managing hooks.
171155
Add the following line to the husky pre-commit configuration in your
@@ -175,6 +159,17 @@ Add the following line to the husky pre-commit configuration in your
175159
talisman --githook pre-commit
176160
```
177161
162+
## Directly invoking talisman
163+
164+
Once the talisman executable is [installed](#install-onto-path-recommended-approach)
165+
you can configure a standalone pre-commit hook for a git repository:
166+
167+
```bash
168+
cd my-git-project
169+
echo "talisman -g pre-commit" >> .git/hooks/pre-commit
170+
chmod +x .git/hooks/pre-commit
171+
```
172+
178173
# Upgrading
179174
Since release v0.4.4, Talisman <b>automatically updates</b> the binary to the latest release, when the hook is invoked (at pre-commit/pre-push, as set up). So, just sit back, relax, and keep using the latest Talisman without any extra efforts.
180175

0 commit comments

Comments
 (0)