wygeneruj artykuł do medium.com dostosowując go do tego kodu, co wyżej oraz tytułu: How to Check the TPM Version and Status in PowerShell or Go

package main

import (
    "flag"
    "fmt"
    "os/exec"
    "strings"
)

var (
    viewActivated               bool
    viewEnabled                 bool
    viewOwned                   bool
    viewManufacturerId          bool
    viewManufacturerIdTxt       bool
    viewManufacturerVersion     bool
    viewManufacturerVersionFull bool
    viewManufacturerVersionInfo bool
    viewPhysicalPresenceVersion bool
    viewSpecVersion             bool
    viewPSComputerName          bool
    viewHelp                    bool
)

func init() {
    flag.BoolVar(&viewActivated, "a", false, "View IsActivated_InitialValue")
    flag.BoolVar(&viewEnabled, "e", false, "View IsEnabled_InitialValue")
    flag.BoolVar(&viewOwned, "o", false, "View IsOwned_InitialValue")
    flag.BoolVar(&viewManufacturerId, "id", false, "View ManufacturerId")
    flag.BoolVar(&viewManufacturerIdTxt, "idt", false, "View ManufacturerIdTxt")
    flag.BoolVar(&viewManufacturerVersion, "mv", false, "View ManufacturerVersion")
    flag.BoolVar(&viewManufacturerVersionFull, "mvf", false, "View ManufacturerVersionFull20")
    flag.BoolVar(&viewManufacturerVersionInfo, "mvi", false, "View ManufacturerVersionInfo")
    flag.BoolVar(&viewPhysicalPresenceVersion, "ppvi", false, "View PhysicalPresenceVersionInfo")
    flag.BoolVar(&viewSpecVersion, "sv", false, "View SpecVersion")
    flag.BoolVar(&viewPSComputerName, "psc", false, "View PSComputerName")
    flag.BoolVar(&viewHelp, "h", false, "View help screen")

    flag.Parse()
}

func main() {
    if viewHelp {
        printHelp()
        return
    }

    cmd := exec.Command("powershell", "-Command", "$tpm = Get-WmiObject -Namespace \"Root\\CIMv2\\Security\\MicrosoftTpm\" -Class Win32_Tpm; Write-Host \"SpecVersion: $($tpm.SpecVersion)\"; Write-Host \"ManufacturerID: $($tpm.ManufacturerID)\"")
    output, err := cmd.Output()
    if err != nil {
        fmt.Println("Błąd podczas wykonania polecenia PowerShell:", err)
        return
    }

    info := string(output)
    lines := strings.Split(info, "\n")
    for _, line := range lines {
        line = strings.TrimSpace(line)
        printLine(line)
    }
}

func printLine(line string) {
    if viewSpecVersion && strings.HasPrefix(line, "SpecVersion:") {
        fmt.Println(line)
    }
    if viewManufacturerId && strings.HasPrefix(line, "ManufacturerID:") {
        fmt.Println(line)
    }
    if viewActivated && strings.HasPrefix(line, "IsActivated_InitialValue:") {
        fmt.Println(line)
    }
    if viewEnabled && strings.HasPrefix(line, "IsEnabled_InitialValue:") {
        fmt.Println(line)
    }
    if viewOwned && strings.HasPrefix(line, "IsOwned_InitialValue:") {
        fmt.Println(line)
    }
    if viewManufacturerIdTxt && strings.HasPrefix(line, "ManufacturerIdTxt:") {
        fmt.Println(line)
    }
    if viewManufacturerVersion && strings.HasPrefix(line, "ManufacturerVersion:") {
        fmt.Println(line)
    }
    if viewManufacturerVersionFull && strings.HasPrefix(line, "ManufacturerVersionFull20:") {
        fmt.Println(line)
    }
    if viewManufacturerVersionInfo && strings.HasPrefix(line, "ManufacturerVersionInfo:") {
        fmt.Println(line)
    }
    if viewPhysicalPresenceVersion && strings.HasPrefix(line, "PhysicalPresenceVersionInfo:") {
        fmt.Println(line)
    }
    if viewPSComputerName && strings.HasPrefix(line, "PSComputerName:") {
        fmt.Println(line)
    }
}

func printHelp() {
    fmt.Println("cTMP Help:")
    flag.PrintDefaults()
}