shellfirm 0.4.2

`shellfirm` will intercept any risky patterns (default or defined by you) and prompt you a small challenge for double verification, kinda like a captcha for your terminal.
Documentation
---
source: shellfirm/src/bin/cmd/init.rs
expression: shell.hook()
---
# shellfirm hook for PowerShell
$global:__shellfirm_hook_version = 14
# Lets `shellfirm doctor` tell whether the shell it runs in loaded the hook.
$env:SHELLFIRM_HOOK_PID = "$PID"
Set-PSReadLineKeyHandler -Key Enter -ScriptBlock {
    $line = $null
    $cursor = $null
    [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$line, [ref]$cursor)

    if ([string]::IsNullOrWhiteSpace($line) -or -not (Get-Command shellfirm -CommandType Application -ErrorAction SilentlyContinue)) {
        [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
        return
    }

    Write-Host ""
    & shellfirm pre-command --direct-tty "--command=$line"
    # 3: allowed after a passed challenge (SHELLFIRM_SIGNAL_PROMPTED=1 in
    # the environment).
    if ($LASTEXITCODE -eq 0 -or $LASTEXITCODE -eq 3) {
        [Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
    } else {
        [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt()
    }
}