Skip to content

Commit 6574d78

Browse files
committed
📌 Chore: Run go mod tidy
1 parent 4bdba76 commit 6574d78

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

cmd/root.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
package cmd
22

3-
import (
4-
"github.com/mattn/go-colorable"
5-
)
3+
import "github.com/mattn/go-colorable"
64

75
func Main() {
8-
defer colorable.EnableColorsStdout(nil)()
6+
// Windows Support
7+
defer colorable.EnableColorsStdout(nil)()
98

10-
help, isThereFileArguments, files := getParametersAndFlags()
9+
help, thereFileArguments, files := getParametersAndFlags()
1110

1211
if help {
1312
PrintHelp()
1413
return
1514
}
1615

17-
if isThereFileArguments {
16+
if thereFileArguments {
1817
text := JoinFilesToString(files)
1918
PrintWithScanner(text)
2019
return

cmd/utils.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,6 @@ import (
1212

1313
const VERSION = "1.0.0"
1414

15-
func JoinFilesToString(files []string) string {
16-
text := make([]string, len(files))
17-
18-
for index, file := range files {
19-
20-
fileText, err := os.ReadFile(file)
21-
22-
if err != nil {
23-
fmt.Println(fmt.Sprintf("Error while trying to read file %s.", file))
24-
os.Exit(1)
25-
}
26-
27-
text[index] = string(fileText)
28-
}
29-
30-
return strings.Join(text, "\n")
31-
}
32-
3315
func PrintHelp() {
3416

3517
helpMessage := ` Chigo %s
@@ -44,11 +26,29 @@ func PrintHelp() {
4426
fortune | chigo # Display a rainbow cookie.
4527
4628
If you need more help, found a bug or want to suggest a new feature:
47-
github.com/UltiRequiem/chigo`
29+
https://github.com/UltiRequiem/chigo`
4830

4931
PrintWithScanner(fmt.Sprintf(helpMessage, VERSION))
5032
}
5133

34+
func JoinFilesToString(files []string) string {
35+
text := make([]string, len(files))
36+
37+
for index, file := range files {
38+
39+
fileText, err := os.ReadFile(file)
40+
41+
if err != nil {
42+
fmt.Println(fmt.Sprintf("Error while trying to read file %s.", file))
43+
os.Exit(1)
44+
}
45+
46+
text[index] = string(fileText)
47+
}
48+
49+
return strings.Join(text, "\n")
50+
}
51+
5252
func PrintWithScanner(text string) {
5353
scanner := bufio.NewScanner(strings.NewReader(text))
5454

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ module github.com/UltiRequiem/chigo
22

33
go 1.17
44

5+
require github.com/mattn/go-colorable v0.1.11
6+
57
require (
6-
github.com/mattn/go-colorable v0.1.11 // indirect
78
github.com/mattn/go-isatty v0.0.14 // indirect
89
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
910
)

go.sum

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
github.com/mattn/go-colorable v0.1.11 h1:nQ+aFkoE2TMGc0b68U2OKSexC+eq46+XwZzWXHRmPYs=
2+
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
3+
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
4+
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
5+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
6+
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
7+
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

0 commit comments

Comments
 (0)