Skip to content

Commit c059384

Browse files
authored
Create cli.ps1 (#151)
Translates cli.sh for use in Windows. *nix: ./cli.sh transform --help Windows: .\cli.ps1 transform --help
1 parent 6802ed9 commit c059384

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: cli.ps1

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##Built in PowerShell v5.1, but should work in any version.
2+
$CUR_DIR = Get-Location | Select-Object -ExpandProperty Path
3+
$SCRIPT_DIR = $PSScriptRoot
4+
$date = [DateTimeOffset]::Now.ToUnixTimeSeconds()
5+
Set-Location $SCRIPT_DIR
6+
go build -o $CUR_DIR\op.exe -ldflags "-X main.gitCommit=$(git rev-parse HEAD) -X main.buildEpochSec=$date" "$SCRIPT_DIR\\cli\\op.go"
7+
if ($?) {
8+
Set-Location $CUR_DIR
9+
$opargs = './op.exe ' + $args -join " "
10+
Invoke-Expression $opargs
11+
} else {
12+
Write-Host "Failed to build op.exe. cli.ps1 may not be working correctly."
13+
Exit
14+
}

0 commit comments

Comments
 (0)