Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.

Commit ad0b8e9

Browse files
committed
create secman code scripts
1 parent b04685c commit ad0b8e9

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

scripts/bfs.ps1

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Build From Source
2+
$loc = "$HOME\AppData\Local\secman"
3+
4+
go run scripts/date.go >> date.txt
5+
6+
$LATEST_VERSION=git describe --abbrev=0 --tags
7+
$DATE=cat date.txt
8+
9+
# Build
10+
go mod tidy
11+
go build -o secman.exe -ldflags "-X main.version=$LATEST_VERSION -X main.versionDate=$DATE"
12+
13+
# Setup
14+
$BIN = "$loc\bin"
15+
New-Item -ItemType "directory" -Path $BIN
16+
Move-Item secman.exe -Destination $BIN
17+
[System.Environment]::SetEnvironmentVariable("Path", $Env:Path + ";$BIN", [System.EnvironmentVariableTarget]::User)
18+
19+
if (Test-Path -path $loc) {
20+
Write-Host "Secman was built successfully, refresh your powershell and then run 'secman --help'" -ForegroundColor DarkGreen
21+
} else {
22+
Write-Host "Build failed" -ForegroundColor Red
23+
}

scripts/date.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"time"
6+
)
7+
8+
func main() {
9+
currentTime := time.Now()
10+
11+
fmt.Println("(" + currentTime.Format("2006-01-02") + ")")
12+
}

scripts/tag.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
tag="${1}"
4+
5+
while (($#)); do
6+
case "$2" in
7+
8+
-a)
9+
git tag -a "${tag}" -m ""
10+
exit 0
11+
;;
12+
13+
-p)
14+
git push origin "${tag}"
15+
exit 0
16+
;;
17+
18+
-x)
19+
git tag -a "${tag}" -m ""
20+
git push origin "${tag}"
21+
exit 0
22+
;;
23+
24+
-d)
25+
git tag -d "${tag}"
26+
git push --delete origin "${tag}"
27+
exit 0
28+
;;
29+
30+
esac
31+
done

0 commit comments

Comments
 (0)