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

Commit 4390506

Browse files
committed
move vars to function
1 parent 1942416 commit 4390506

1 file changed

Lines changed: 35 additions & 34 deletions

File tree

v_checker.go

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,43 @@ 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-
`
4612

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

0 commit comments

Comments
 (0)