File: Check-Git.ps1

package info (click to toggle)
obs-source-clone 0.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 492 kB
  • sloc: ansic: 948; makefile: 23; cpp: 16
file content (25 lines) | stat: -rwxr-xr-x 698 bytes parent folder | download | duplicates (39)
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
function Check-Git {
    <#
        .SYNOPSIS
            Ensures available git executable on host system.
        .DESCRIPTION
            Checks whether a git command is available on the host system. If none is found,
            Git is installed via winget.
        .EXAMPLE
            Check-Git
    #>

    if ( ! ( Test-Path function:Log-Info ) ) {
        . $PSScriptRoot/Logger.ps1
    }

    Log-Information 'Checking for Git executable...'

    if ( ! ( Get-Command git ) ) {
        Log-Warning 'No Git executable found. Will try to install via winget.'
        winget install git
    } else {
        Log-Debug "Git found at $(Get-Command git)."
        Log-Status "Git found."
    }
}