Skip to content

Commit b599207

Browse files
committed
feat: add help
1 parent 349e353 commit b599207

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
module github.com/markthree/clean-cache
22

33
go 1.21.0
4+
5+
require github.com/fatih/color v1.15.0
6+
7+
require (
8+
github.com/mattn/go-colorable v0.1.13 // indirect
9+
github.com/mattn/go-isatty v0.0.17 // indirect
10+
golang.org/x/sys v0.6.0 // indirect
11+
)

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
2+
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
3+
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
4+
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
5+
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
6+
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
7+
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
8+
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9+
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
10+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

main.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
package main
22

3+
import (
4+
"fmt"
5+
"os"
6+
7+
"github.com/fatih/color"
8+
)
9+
10+
func isHelp() bool {
11+
for _, v := range os.Args {
12+
if v == "-h" || v == "--help" || v == "help" {
13+
return true
14+
}
15+
}
16+
return false
17+
}
18+
319
func main() {
420

21+
if isHelp() {
22+
fmt.Print("\n")
23+
color.Cyan("clean-cache")
24+
fmt.Print("Description: go 写的清理 node 项目缓存,超级无敌快\n\n")
25+
os.Exit(0)
26+
}
27+
528
}

0 commit comments

Comments
 (0)