Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Commit 1942416

Browse files
committed
update v_checker without verx
1 parent c3cefee commit 1942416

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

v_checker.go

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,41 @@ import (
99
"github.com/briandowns/spinner"
1010
)
1111

12+
check_w := `
13+
$releases = "https://api.github.com/repos/secman-team/secman/releases"
14+
15+
$l = (Invoke-WebRequest -Uri $releases -UseBasicParsing | ConvertFrom-Json)[0].tag_name
16+
17+
$c = secman verx
18+
19+
if ($l -ne $c) {
20+
$nr = "there's a new release of secman is avalaible: "
21+
$up = "to upgrade run "
22+
$smu = "sm-upg start"
23+
24+
Write-Host ""
25+
Write-Host -NoNewline $nr -ForegroundColor DarkYellow
26+
Write-Host "$c -> $l" -ForegroundColor DarkCyan
27+
Write-Host -NoNewline $up -ForegroundColor DarkYellow
28+
Write-Host $smu -ForegroundColor DarkCyan
29+
}
30+
`
31+
32+
check_ml := `
33+
l=$(curl --silent "https://api.github.com/repos/secman-team/secman/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
34+
c=$(secman verx | tr -d '\n')
35+
36+
if [ $l != $c ]; then
37+
nr="there's a new release of secman is avalaible:"
38+
up="to upgrade run"
39+
smu="secman upgrade"
40+
41+
echo ""
42+
echo "$nr $c -> $l"
43+
echo "$up $smu"
44+
fi
45+
`
46+
1247
func Checker() {
1348
s := spinner.New(spinner.CharSets[11], 100*time.Millisecond)
1449
s.Suffix = " 🔍 Checking for updates..."
@@ -17,9 +52,9 @@ func Checker() {
1752
err, out, errout := shell.ShellOut("")
1853

1954
if runtime.GOOS == "windows" {
20-
err, out, errout = shell.PWSLOut("& ~/sm/vx.ps1 --sm")
55+
err, out, errout = shell.PWSLOut(check_w)
2156
} else {
22-
err, out, errout = shell.ShellOut("verx --sm")
57+
err, out, errout = shell.ShellOut(check_ml)
2358
}
2459

2560
if err != nil {

0 commit comments

Comments
 (0)