Skip to content

Commit d4fceca

Browse files
committed
uprade to friendly v2 and clean up
1 parent d731ffa commit d4fceca

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

config.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
"path"
88

9-
"github.com/alexcoder04/friendly"
9+
"github.com/alexcoder04/friendly/v2/ffiles"
1010
)
1111

1212
// utils {{{
@@ -16,15 +16,15 @@ func getConfigFile() string {
1616

1717
func createConfigFolder() error {
1818
configFolder := path.Dir(getConfigFile())
19-
if !friendly.IsDir(configFolder) {
19+
if !ffiles.IsDir(configFolder) {
2020
return os.MkdirAll(configFolder, 0700)
2121
}
2222
return nil
2323
}
2424

2525
func readConfig() (map[string]string, error) {
2626
configFile := getConfigFile()
27-
if !friendly.IsFile(configFile) {
27+
if !ffiles.IsFile(configFile) {
2828
return map[string]string{}, nil
2929
}
3030

gilc.go

-3
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,9 @@ func Run() {
6565
fmt.Printf(`{"Description": "%s"}`+"\n", Plugin.Description)
6666
case "main":
6767
Plugin.Main(Plugin.Data)
68-
break
6968
case "shutdown":
7069
Plugin.Shutdown(Plugin.Data)
71-
break
7270
default:
7371
Plugin.Command(Plugin.Data, os.Args[3:])
74-
break
7572
}
7673
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.18
44

55
require (
66
github.com/alexcoder04/arrowprint v0.0.1
7-
github.com/alexcoder04/friendly v0.0.0-20220724153717-2c05924b8c1c
7+
github.com/alexcoder04/friendly/v2 v2.0.0
88
github.com/mattn/go-colorable v0.1.13
99
)
1010

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/alexcoder04/arrowprint v0.0.1 h1:JOGDAmow9n1lZJkHFt3qP7vfqKZpmaeifPd9J+eHRac=
22
github.com/alexcoder04/arrowprint v0.0.1/go.mod h1:vscFtiqe8wW9Bd3Gwl5u224YiBUWGL+x2prgtaoDB/U=
3-
github.com/alexcoder04/friendly v0.0.0-20220724153717-2c05924b8c1c h1:NqI7gPORzOwG/dfv4y/nDi0pZ53XQ2kuTeZpi12LvMs=
4-
github.com/alexcoder04/friendly v0.0.0-20220724153717-2c05924b8c1c/go.mod h1:mHI5Rm6HB+Jjd69RYJ9/9c7J1qCtfyBvoJPSIm0yslo=
3+
github.com/alexcoder04/friendly/v2 v2.0.0 h1:IHSCsqGmfEciPqEM0+xaPKpQ0NAO9GGTKe+GLLkP+Eo=
4+
github.com/alexcoder04/friendly/v2 v2.0.0/go.mod h1:mDdl0T9duMHVIVVTDgkXO7TE3rmjR6OO9PMdvEoqIH4=
55
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
66
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
77
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=

io.go

-9
Original file line numberDiff line numberDiff line change
@@ -47,31 +47,22 @@ func Write(msg string) {
4747
switch c {
4848
case '0', '8':
4949
fmt.Fprint(out, "\033[30m")
50-
break
5150
case '1', '9':
5251
fmt.Fprint(out, "\033[34")
53-
break
5452
case '2', 'a':
5553
fmt.Fprintf(out, "\033[32m")
56-
break
5754
case '3', 'b':
5855
fmt.Fprintf(out, "\033[36m")
59-
break
6056
case '4', 'c':
6157
fmt.Fprintf(out, "\033[31m")
62-
break
6358
case '5', 'd':
6459
fmt.Fprintf(out, "\033[35m")
65-
break
6660
case '6', 'e':
6761
fmt.Fprintf(out, "\033[33m")
68-
break
6962
case '7', 'f':
7063
fmt.Fprintf(out, "\033[37m")
71-
break
7264
case 'r':
7365
fmt.Fprint(out, "\033[0m")
74-
break
7566
default:
7667
break
7768
}

0 commit comments

Comments
 (0)