File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,16 +70,16 @@ func WriteConfig(write func(config *Config)) {
7070// loadDefaultConfig 加载默认配置 返回使用的配置文件
7171func loadDefaultConfig () string {
7272
73- defaultConfigPaths := []string {}
73+ var defaultConfigPaths []string
7474
7575 // 读取工作目录的 config.json
7676 if p , err := os .Getwd (); err == nil {
7777 defaultConfigPaths = append (defaultConfigPaths , filepath .Join (p , "config.json" ))
7878 }
7979
8080 // 读取用户目录下的 opensca_config.json
81- if user , err := user .Current (); err == nil {
82- defaultConfigPaths = append (defaultConfigPaths , filepath .Join (user .HomeDir , "opensca_config.json" ))
81+ if currenUser , err := user .Current (); err == nil {
82+ defaultConfigPaths = append (defaultConfigPaths , filepath .Join (currenUser .HomeDir , "opensca_config.json" ))
8383 }
8484
8585 // 读取 opensca-cli 所在目录下的 config.json
@@ -132,7 +132,10 @@ func RegisterDefaultConfig(data []byte) {
132132 defalutConfigJson = data
133133 if _config == nil {
134134 _config = & Config {}
135- json5 .Unmarshal (defalutConfigJson , & _config )
135+ err := json5 .Unmarshal (defalutConfigJson , & _config )
136+ if err != nil {
137+ logs .Warnf ("unmarshal default config error: %v" , err )
138+ }
136139 }
137140}
138141
Original file line number Diff line number Diff line change @@ -30,6 +30,17 @@ var version string
3030
3131func main () {
3232
33+ logo := `
34+ ___ ____ ____ _
35+ / _ \ _ __ ___ _ __ / ___| / ___| / \
36+ | | | | '_ \ / _ \ '_ \\___ \| | / _ \
37+ | |_| | |_) | __/ | | |___) | |___ / ___ \
38+ \___/| .__/ \___|_| |_|____/ \____/_/ \_\
39+ |_|`
40+
41+ fmt .Println (logo )
42+ fmt .Println ("Current version: " , version )
43+
3344 // 处理参数
3445 args ()
3546
You can’t perform that action at this time.
0 commit comments