Skip to content

Commit 08fee36

Browse files
committed
feat: Add ASCII art logo
1 parent d8007e9 commit 08fee36

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

cmd/config/config.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ func WriteConfig(write func(config *Config)) {
7070
// loadDefaultConfig 加载默认配置 返回使用的配置文件
7171
func 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

main.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,26 @@ var version string
3030

3131
func main() {
3232

33+
/*
34+
___ ____ ____ _
35+
/ _ \ _ __ ___ _ __ / ___| / ___| / \
36+
| | | | '_ \ / _ \ '_ \\___ \| | / _ \
37+
| |_| | |_) | __/ | | |___) | |___ / ___ \
38+
\___/| .__/ \___|_| |_|____/ \____/_/ \_\
39+
|_|
40+
*/
41+
42+
logo := `
43+
___ ____ ____ _
44+
/ _ \ _ __ ___ _ __ / ___| / ___| / \
45+
| | | | '_ \ / _ \ '_ \\___ \| | / _ \
46+
| |_| | |_) | __/ | | |___) | |___ / ___ \
47+
\___/| .__/ \___|_| |_|____/ \____/_/ \_\
48+
|_|`
49+
50+
fmt.Println(logo)
51+
fmt.Println("Current version: ", version)
52+
3353
// 处理参数
3454
args()
3555

0 commit comments

Comments
 (0)