{
    "version": "2.1.12",
    "description": "Regular expression search and replace tool for Windows.",
    "homepage": "https://tools.stefankueng.com/grepWin.html",
    "license": "GPL-3.0-only",
    "notes": [
        "To add grepWin to right-click context menu, run:",
        "reg import \"$dir\\install-context.reg\""
    ],
    "architecture": {
        "64bit": {
            "url": "https://github.com/stefankueng/grepWin/releases/download/2.1.12/grepWin-x64-2.1.12_portable.zip",
            "hash": "55f0352144d67ae03c6f24db642d080c895833593b25b900339bc92a5b4d7234"
        },
        "32bit": {
            "url": "https://github.com/stefankueng/grepWin/releases/download/2.1.12/grepWin-2.1.12_portable.zip",
            "hash": "109399cc6fc6782daedad85e8d63033ca2e76c4b027ba28af826a1b5f53440e2"
        }
    },
    "pre_install": [
        "Get-ChildItem \"$dir\\grepWin*.exe\" | Rename-Item -NewName 'grepWin_portable.exe'",
        "if (-not (Test-Path \"$persist_dir\\grepwin.ini\")) {",
        "    Set-Content \"$dir\\grepwin.ini\" (@('[global]', '[Software\\grepWin\\History]') -join \"`r`n\") -Encoding ASCII",
        "}"
    ],
    "post_install": [
        "# keep the 'portable' suffix to ensure it runs in portable mode.",
        "$app_path = \"$dir\\grepWin_portable.exe\".Replace('\\', '\\\\')",
        "'install-context.reg', 'uninstall-context.reg' | ForEach-Object {",
        "    if (Test-Path \"$bucketsdir\\extras\\scripts\\grepwin\\$_\") {",
        "        $content = Get-Content \"$bucketsdir\\extras\\scripts\\grepwin\\$_\"",
        "        $content = $content.Replace('$app_path', $app_path)",
        "        if ($global) {",
        "            $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE')",
        "        }",
        "    }",
        "    $content | Set-Content -Path \"$dir\\$_\" -Encoding ascii",
        "}",
        "# Workaround for https://github.com/ScoopInstaller/Extras/pull/17697 (Remove this workaround after 2027-01-01)",
        "if ($cmd -eq 'update') {",
        "    $regPath = 'HKCU:\\Software\\Classes\\*\\shell\\grepWin\\command'",
        "    if ($global) {",
        "        $regPath = $regPath -replace '^HKCU', 'HKLM'",
        "    }",
        "    $regValue = Get-ItemProperty -LiteralPath $regPath -ErrorAction Ignore",
        "    if ($regValue -and $regValue.'(default)' -match \"^$([regex]::Escape($(appdir $app $global)))\") {",
        "        reg import \"$dir\\install-context.reg\" *> $null",
        "    }",
        "}"
    ],
    "bin": [
        [
            "grepWin_portable.exe",
            "grepWin"
        ]
    ],
    "shortcuts": [
        [
            "grepWin_portable.exe",
            "grepWin"
        ]
    ],
    "persist": "grepwin.ini",
    "pre_uninstall": "if ($cmd -eq 'uninstall') { reg import \"$dir\\uninstall-context.reg\" *> $null }",
    "checkver": {
        "github": "https://github.com/stefankueng/grepWin"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://github.com/stefankueng/grepWin/releases/download/$version/grepWin-x64-$version_portable.zip"
            },
            "32bit": {
                "url": "https://github.com/stefankueng/grepWin/releases/download/$version/grepWin-$version_portable.zip"
            }
        }
    }
}
