@@ -7,55 +7,20 @@ import (
77 "runtime"
88 "github.com/secman-team/shell"
99 "github.com/briandowns/spinner"
10+ commands "github.com/secman-team/secman/tools/constants"
1011)
1112
12-
1313func 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-
4914 s := spinner .New (spinner .CharSets [11 ], 100 * time .Millisecond )
5015 s .Suffix = " 🔍 Checking for updates..."
5116 s .Start ()
5217
5318 err , out , errout := shell .ShellOut ("" )
5419
5520 if runtime .GOOS == "windows" {
56- err , out , errout = shell .PWSLOut (check_w )
21+ err , out , errout = shell .PWSLOut (commands . Check_w () )
5722 } else {
58- err , out , errout = shell .ShellOut (check_ml )
23+ err , out , errout = shell .ShellOut (commands . Check_ml () )
5924 }
6025
6126 if err != nil {
0 commit comments