forked from HabanaAI/DeepSpeed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit-toggle.sh
More file actions
executable file
·37 lines (31 loc) · 900 Bytes
/
pre-commit-toggle.sh
File metadata and controls
executable file
·37 lines (31 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Path to the pre-commit configuration file
PRE_COMMIT_CONFIG=".pre-commit-config.yaml"
# Install pre-commit
pip install -r ${DEEPSPEED_FORK_ROOT}/requirements/requirements-dev.txt
# Enable pre-commit
function enable_pre_commit() {
# Install pre-commit hooks
pre-commit install
}
# Disable pre-commit
function disable_pre_commit() {
# Install pre-commit hooks
pre-commit uninstall
}
# Check if the pre-commit configuration file exists
if [ -f "$PRE_COMMIT_CONFIG" ]; then
echo "Pre-commit configuration file found: $PRE_COMMIT_CONFIG"
else
echo "Pre-commit configuration file not found: $PRE_COMMIT_CONFIG"
exit 1
fi
# Check the command-line argument to enable or disable pre-commit
if [ "$1" == "enable" ]; then
enable_pre_commit
elif [ "$1" == "disable" ]; then
disable_pre_commit
else
echo "Usage: ./pre-commit-toggle.sh [enable|disable]"
exit 1
fi