Skip to content

Commit a12411b

Browse files
committed
change color print
1 parent aa19227 commit a12411b

16 files changed

+50
-50
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ docs: mod fmt
6969
# delete the templates code end
7070

7171
.PHONY: proto
72-
# generate *.go and template code by proto files, if you do not refer to the proto file, the default is all the proto files in the api directory. you can specify the proto file, multiple files are separated by commas, e.g. make proto FILES=api/user/v1/user.proto, only for ⓶ Microservices created based on sql, ⓷ Web services created based on protobuf, ⓸ Microservices created based on protobuf, ⓹ grpc gateway service created based on protobuf
72+
# generate *.go and template code by proto files, if you do not refer to the proto file, the default is all the proto files in the api directory. you can specify the proto file, multiple files are separated by commas, e.g. make proto FILES=api/user/v1/user.proto, only for ⓶ Microservices created based on sql, ⓷ Web services created based on protobuf, ⓸ Microservices created based on protobuf, ⓹ grpc gateway service created based on protobuf, ⓺ Create grpc+http service based on protobuf
7373
proto:
7474
@bash scripts/protoc.sh $(FILES)
7575
go mod tidy
@@ -214,7 +214,7 @@ help:
214214
if (helpMessage) { \
215215
helpCommand = substr($$1, 0, index($$1, ":")-1); \
216216
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
217-
printf "\033[36m %-22s\033[0m %s\n", helpCommand,helpMessage; \
217+
printf "\033[1;36m %-22s\033[0m %s\n", helpCommand,helpMessage; \
218218
} \
219219
} \
220220
{ lastLine = $$0 }' $(MAKEFILE_LIST)

Makefile-for-http

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ help:
151151
if (helpMessage) { \
152152
helpCommand = substr($$1, 0, index($$1, ":")-1); \
153153
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
154-
printf "\033[36m %-22s\033[0m %s\n", helpCommand,helpMessage; \
154+
printf "\033[1;36m %-22s\033[0m %s\n", helpCommand,helpMessage; \
155155
} \
156156
} \
157157
{ lastLine = $$0 }' $(MAKEFILE_LIST)

cmd/sponge/commands/generate/template.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ func NewCenter(configFile string) (*Center, error) {
267267
sponge merge rpc-pb
268268
checkResult $?
269269
270-
colorCyan='\e[1;36m'
271-
highBright='\e[1m'
272-
markEnd='\e[0m'
270+
colorCyan='\033[1;36m'
271+
highBright='\033[1m'
272+
markEnd='\033[0m'
273273
274274
echo ""
275275
echo -e "${highBright}Tip:${markEnd} execute the command ${colorCyan}make run${markEnd} and then test grpc api in the file ${colorCyan}internal/service/xxx_client_test.go${markEnd}."
@@ -301,9 +301,9 @@ func NewCenter(configFile string) (*Center, error) {
301301
sponge merge http-pb
302302
checkResult $?
303303
304-
colorCyan='\e[1;36m'
305-
highBright='\e[1m'
306-
markEnd='\e[0m'
304+
colorCyan='\033[1;36m'
305+
highBright='\033[1m'
306+
markEnd='\033[0m'
307307
308308
echo ""
309309
echo -e "${highBright}Tip:${markEnd} execute the command ${colorCyan}make run${markEnd} and then visit ${colorCyan}http://localhost:8080/apis/swagger/index.html${markEnd} in your browser. "
@@ -335,9 +335,9 @@ func NewCenter(configFile string) (*Center, error) {
335335
sponge merge rpc-gw-pb
336336
checkResult $?
337337
338-
colorCyan='\e[1;36m'
339-
highBright='\e[1m'
340-
markEnd='\e[0m'
338+
colorCyan='\033[1;36m'
339+
highBright='\033[1m'
340+
markEnd='\033[0m'
341341
342342
echo ""
343343
echo -e "${highBright}Tip:${markEnd} execute the command ${colorCyan}make run${markEnd} and then visit ${colorCyan}http://localhost:8080/apis/swagger/index.html${markEnd} in your browser."
@@ -379,9 +379,9 @@ func NewCenter(configFile string) (*Center, error) {
379379
sponge merge http-pb
380380
checkResult $?
381381
382-
colorCyan='\e[1;36m'
383-
highBright='\e[1m'
384-
markEnd='\e[0m'
382+
colorCyan='\033[1;36m'
383+
highBright='\033[1m'
384+
markEnd='\033[0m'
385385
386386
echo ""
387387
echo -e "${highBright}Tip:${markEnd} execute the command ${colorCyan}make run${markEnd} and then"

cmd/sponge/commands/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Examples:
2222
SilenceErrors: true,
2323
SilenceUsage: true,
2424
RunE: func(cmd *cobra.Command, args []string) error {
25-
fmt.Println("initialize sponge ......")
25+
fmt.Println("initializing sponge, please wait a moment ......")
2626

2727
targetVersion := latestVersion
2828
// download sponge template code

cmd/sponge/commands/plugins.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ var pluginNames = []string{
2525
"protoc-gen-openapiv2",
2626
"protoc-gen-doc",
2727
"swag",
28-
"golangci-lint",
29-
"go-callvis",
28+
//"golangci-lint",
29+
//"go-callvis",
3030
}
3131

3232
var installPluginCommands = map[string]string{
@@ -40,13 +40,13 @@ var installPluginCommands = map[string]string{
4040
"protoc-gen-go-rpc-tmpl": "github.com/zhufuyi/sponge/cmd/protoc-gen-go-rpc-tmpl@latest",
4141
"protoc-gen-openapiv2": "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest",
4242
"protoc-gen-doc": "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest",
43-
"golangci-lint": "github.com/golangci/golangci-lint/cmd/golangci-lint@latest",
4443
"swag": "github.com/swaggo/swag/cmd/swag@v1.8.12",
45-
"go-callvis": "github.com/ofabry/go-callvis@latest",
44+
//"golangci-lint": "github.com/golangci/golangci-lint/cmd/golangci-lint@latest",
45+
//"go-callvis": "github.com/ofabry/go-callvis@latest",
4646
}
4747

4848
const (
49-
isntalledSymbol = "✔ "
49+
installedSymbol = "✔ "
5050
lackSymbol = "❌ "
5151
warnSymbol = "⚠ "
5252
)
@@ -117,7 +117,7 @@ func showDependencyPlugins(installedNames []string, lackNames []string) {
117117
if len(installedNames) > 0 {
118118
content = "Installed dependency plugins:\n"
119119
for _, name := range installedNames {
120-
content += " " + isntalledSymbol + " " + name + "\n"
120+
content += " " + installedSymbol + " " + name + "\n"
121121
}
122122
}
123123

@@ -165,7 +165,7 @@ func installPlugins(lackNames []string) {
165165
if result.Err != nil {
166166
fmt.Printf("%s %s, %v\n", lackSymbol, name, result.Err)
167167
} else {
168-
fmt.Printf("%s %s\n", isntalledSymbol, name)
168+
fmt.Printf("%s %s\n", installedSymbol, name)
169169
}
170170
}(name)
171171
}

cmd/sponge/commands/upgrade.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Examples:
3333
SilenceErrors: true,
3434
SilenceUsage: true,
3535
RunE: func(cmd *cobra.Command, args []string) error {
36-
fmt.Println("upgrade sponge ......")
36+
fmt.Println("upgrading sponge, please wait a moment ......")
3737
if targetVersion == "" {
3838
targetVersion = latestVersion
3939
}
@@ -56,19 +56,19 @@ func runUpgrade(targetVersion string) (string, error) {
5656
fmt.Println(lackSymbol + "upgrade sponge binary.")
5757
return "", err
5858
}
59-
fmt.Println(isntalledSymbol + "upgraded sponge binary.")
59+
fmt.Println(installedSymbol + "upgraded sponge binary.")
6060
ver, err := copyToTempDir(targetVersion)
6161
if err != nil {
6262
fmt.Println(lackSymbol + "upgrade template code.")
6363
return "", err
6464
}
65-
fmt.Println(isntalledSymbol + "upgraded template code.")
65+
fmt.Println(installedSymbol + "upgraded template code.")
6666
err = updateSpongeInternalPlugin(ver)
6767
if err != nil {
6868
fmt.Println(lackSymbol + "upgrade protoc plugins.")
6969
return "", err
7070
}
71-
fmt.Println(isntalledSymbol + "upgraded protoc plugins.")
71+
fmt.Println(installedSymbol + "upgraded protoc plugins.")
7272
return ver, nil
7373
}
7474

scripts/deploy-docker.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ checkResult $?
2323
docker-compose up -d
2424
checkResult $?
2525

26-
colorCyan='\e[1;36m'
27-
highBright='\e[1m'
28-
markEnd='\e[0m'
26+
colorCyan='\033[1;36m'
27+
highBright='\033[1m'
28+
markEnd='\033[0m'
2929

3030
echo ""
3131
echo -e "run service successfully, if you want to stop the service, go into the ${highBright}${dockerComposeFilePath}${markEnd} directory and execute the command ${colorCyan}docker-compose down${markEnd}."

scripts/protoc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ function generateBySpecifiedProto(){
180180
sponge merge rpc-gw-pb
181181
checkResult $?
182182

183-
colorCyan='\e[1;36m'
184-
highBright='\e[1m'
185-
markEnd='\e[0m'
183+
colorCyan='\033[1;36m'
184+
highBright='\033[1m'
185+
markEnd='\033[0m'
186186

187187
echo ""
188188
echo -e "${highBright}Tip:${markEnd} execute the command ${colorCyan}make run${markEnd} and then visit ${colorCyan}http://localhost:8080/apis/swagger/index.html${markEnd} in your browser."

scripts/swag-docs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ checkResult $?
2525
sponge patch modify-dup-num --dir=internal/ecode
2626
sponge patch modify-dup-err-code --dir=internal/ecode
2727

28-
colorCyan='\e[1;36m'
29-
highBright='\e[1m'
30-
markEnd='\e[0m'
28+
colorCyan='\033[1;36m'
29+
highBright='\033[1m'
30+
markEnd='\033[0m'
3131

3232
echo ""
3333
echo -e "${highBright}Tip:${markEnd} execute the command ${colorCyan}make run${markEnd} and then visit ${colorCyan}http://${HOST_ADDR}:8080/swagger/index.html${markEnd} in your browser."

test/auto-test/files/1_web_gin.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ webDir="1_web_gin_${webServiceName}"
66
mysqlDSN="root:123456@(192.168.3.37:3306)/school"
77
mysqlTable="teacher"
88

9-
colorCyan='\e[1;36m'
10-
markEnd='\e[0m'
9+
colorCyan='\033[1;36m'
10+
markEnd='\033[0m'
1111
errCount=0
1212

1313
function checkResult() {

0 commit comments

Comments
 (0)