15 lines
584 B
PowerShell
15 lines
584 B
PowerShell
param([Parameter(ValueFromRemainingArguments=$true)][string[]]$Options)
|
|
$ErrorActionPreference = 'Stop'
|
|
$wasSet = Test-Path Env:GITEA_TOKEN
|
|
try {
|
|
$path = Join-Path $env:LOCALAPPDATA 'JobbJakt-Gitea-token.xml'
|
|
if (-not $wasSet -and (Test-Path -LiteralPath $path)) {
|
|
$env:GITEA_TOKEN = [Net.NetworkCredential]::new('', (Import-Clixml -LiteralPath $path)).Password
|
|
}
|
|
python -X utf8 "$PSScriptRoot/gitea_backlog.py" @Options
|
|
$result = $LASTEXITCODE
|
|
} finally {
|
|
if (-not $wasSet) { Remove-Item Env:GITEA_TOKEN -ErrorAction SilentlyContinue }
|
|
}
|
|
exit $result
|