From 86006448bbee372818008b6e842b15b559393c6c Mon Sep 17 00:00:00 2001 From: Michael Sanford Date: Sat, 22 Jun 2019 16:51:10 -0400 Subject: [PATCH] Update README with a PowerShell loop example --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index bca7375..84eb743 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,15 @@ Then use by piping a file into the utility and capturing the output. You must pr $GOPATH/bin/2goarray MyArray mypackage < myimage.png > myimage.go +Or in PowerShell, to loop over a folder of icons and output a .go file corresponding to the icon's name: + +```powershell +$2goarray = Join-Path $Env:GOPATH '\bin\2goarray.exe' +Get-ChildItem *.ico | Foreach-Object { + Get-Content $_.FullName | Invoke-Expression $2goarray $_.BaseName "mypackage" | Out-File -FilePath $($_.BaseName + ".go") -Encoding utf8 +} +``` + This will output something like: package mypackage