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

Commit dbeb27a

Browse files
committed
update secman initializer and add ~/.secman dir checker
1 parent 0dc1f4f commit dbeb27a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

pkg/initx/init.go

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
package initx
22

33
import (
4+
"os"
45
"fmt"
56
"log"
6-
"os"
7-
"path/filepath"
7+
"time"
88
"runtime"
9+
"path/filepath"
910

1011
"github.com/abdfnx/gosh"
12+
"github.com/spf13/viper"
1113
"github.com/abdfnx/tran/dfs"
12-
gapi "github.com/scmn-dev/get-latest/api"
14+
"github.com/briandowns/spinner"
15+
"github.com/charmbracelet/lipgloss"
1316
"github.com/scmn-dev/secman/constants"
14-
"github.com/spf13/viper"
17+
gapi "github.com/scmn-dev/get-latest/api"
1518
)
1619

1720
func Init() {
1821
var err error
1922

23+
s := spinner.New(spinner.CharSets[11], 100*time.Millisecond)
24+
s.Suffix = " 💿 Initializing..."
25+
s.Start()
26+
2027
homeDir, err := dfs.GetHomeDirectory()
2128

2229
if err != nil {
@@ -72,7 +79,7 @@ func Init() {
7279
uCmd := fmt.Sprintf(`
7380
if ! [ -d %s/ui ]; then
7481
wget %s
75-
sudo chmod 755 smui.zip
82+
chmod 755 smui.zip
7683
unzip -qq smui.zip
7784
mv ui %s/ui
7885
rm smui.zip
@@ -90,4 +97,10 @@ func Init() {
9097
`, constants.DotSecmanPath, fmt.Sprintf("\"%s\"", url), constants.DotSecmanPath)
9198

9299
gosh.RunMulti(uCmd, wCmd)
100+
101+
s.Stop()
102+
103+
if _, err := os.Stat(constants.DotSecmanPath); err == nil {
104+
fmt.Println(lipgloss.NewStyle().PaddingLeft(2).SetString(constants.Checkmark + "Initialization Successful!").String())
105+
}
93106
}

0 commit comments

Comments
 (0)