File: pre-commit

package info (click to toggle)
azure-cli 2.83.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,346,000 kB
  • sloc: python: 1,930,197; sh: 1,344; makefile: 407; cs: 145; javascript: 74; sql: 37; xml: 21
file content (24 lines) | stat: -rwxr-xr-x 784 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env sh

# Check if running in Windows
if [ -n "$COMSPEC" ]; then
    # Windows section - Execute directly with PowerShell
    powershell -NoProfile -Command "
        if (Get-Command powershell -ErrorAction SilentlyContinue) {
            Write-Host 'PowerShell found, executing pre-commit.ps1...'
            powershell -ExecutionPolicy Bypass -File '.githooks\pre-commit.ps1'
            exit $LASTEXITCODE
        } else {
            Write-Host 'Error: PowerShell is not available. Please install PowerShell.'
            exit 1
        }
    "
    echo "Exiting with status $?"
    exit $?
else
    # Unix-like system section
    echo "Unix-like system found, executing pre-commit.sh..."
    sh .githooks/pre-commit.sh
    echo "Exiting with status $?"
    exit $?
fi