Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,25 @@ follow the Conventional Commit standard. This will only work if:
Otherwise, you’ll get an error or nothing will happen.

``` bash
spaid_setup_dev_workspace -h
spaid_setup_precommit -h
```

Usage: spaid_setup_dev_workspace \[-h\]
Usage: spaid_setup_precommit \[-h\]

Run this command to either setup up or update your development workspace
to have any helper packages or tools installed and configured. These are
the actions it does currently:
Run this command to setup pre-commit on the repository. It will:

- Installs Python package dependencies (if in a Poetry project)
- Installs pre-commit hooks
- Runs pre-commit hooks on all the files
- Install pre-commit hooks
- Do an initial run of the pre-commit hooks on all the files

This command only works if:

- you are in a local Git repository
- the repository has a file called ‘.pre-commit-config.yaml’

Examples:

spaid_setup_precommit

``` bash
spaid_create_python_files -h
```
Expand Down
2 changes: 1 addition & 1 deletion README.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spaid_lint_commits_on_branch -h

```{bash}
#| output: asis
spaid_setup_dev_workspace -h
spaid_setup_precommit -h
```

```{bash}
Expand Down
41 changes: 0 additions & 41 deletions bin/spaid_setup_dev_workspace

This file was deleted.

36 changes: 36 additions & 0 deletions bin/spaid_setup_precommit
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/zsh

help_text="
Usage: `basename $0` [-h]
Run this command to setup pre-commit on the repository. It will:
- Install pre-commit hooks
- Do an initial run of the pre-commit hooks on all the files
This command only works if:
- you are in a local Git repository
- the repository has a file called '.pre-commit-config.yaml'
Examples:
spaid_setup_precommit
"

if [[ "$1" == "-h" ]] ; then
echo $help_text
exit 0
fi

precommit_file=$(pwd)/.pre-commit-config.yaml

if [[ ! -f "$precommit_file" ]]
then
echo "Error: No '$precommit_file' found. You need to create one to continue."
exit 1
fi

# Install pre-commit hooks as defined in `.pre-commit-config.yaml`
uvx pre-commit install
uvx pre-commit run --all-files
Loading