30 lines
1.1 KiB
PowerShell
30 lines
1.1 KiB
PowerShell
param(
|
|
[Parameter(Position = 0)]
|
|
[ValidateSet('build', 'update', 'query', 'path', 'explain', 'vocab', 'status')]
|
|
[string]$Action = 'update',
|
|
[Parameter(Position = 1, ValueFromRemainingArguments = $true)]
|
|
[string[]]$QueryArgs,
|
|
[string]$Python
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
if (-not $Python -and (Get-Command uv -ErrorAction SilentlyContinue)) {
|
|
$toolDirectory = & uv tool dir
|
|
if ($LASTEXITCODE -eq 0) {
|
|
$candidate = Join-Path $toolDirectory 'graphifyy/Scripts/python.exe'
|
|
if (Test-Path -LiteralPath $candidate) { $Python = $candidate }
|
|
}
|
|
}
|
|
if (-not $Python) {
|
|
$command = Get-Command graphify -ErrorAction SilentlyContinue
|
|
if ($command) {
|
|
$candidate = Join-Path (Split-Path $command.Source) 'python.exe'
|
|
if (Test-Path -LiteralPath $candidate) { $Python = $candidate }
|
|
}
|
|
}
|
|
if (-not $Python) {
|
|
throw 'Graphify not found. Install: uv tool install graphifyy==0.9.93; or pass -Python <graphify Python executable>.'
|
|
}
|
|
& $Python (Join-Path $PSScriptRoot 'graphify_index.py') $Action @QueryArgs
|
|
exit $LASTEXITCODE
|