Skip to content

Commit 15b6d0e

Browse files
committed
Add linter
1 parent e5990bd commit 15b6d0e

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

.github/workflows/linter.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Lint Code Base
2+
on: [push, pull_request]
3+
jobs:
4+
build:
5+
name: Lint Code Base
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout Code
9+
uses: actions/checkout@v2
10+
- name: Lint Code Base
11+
uses: github/[email protected]
12+
env:
13+
VALIDATE_ALL_CODEBASE: false
14+
VALIDATE_ANSIBLE: false

main.go

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/umutphp/awesome-cli/internal/package/favourite"
78
"github.com/umutphp/awesome-cli/internal/package/manager"
89
"github.com/umutphp/awesome-cli/internal/package/prompter"
9-
"github.com/umutphp/awesome-cli/internal/package/favourite"
1010
)
1111

1212
const (
13+
// CACHE_KEY is the name of the cache folder
1314
CACHE_KEY = "awesome"
1415
// VERSION of the cli
15-
VERSION = "0.3.0"
16+
VERSION = "0.3.0"
1617
)
1718

18-
19-
2019
func main() {
21-
args := os.Args[1:]
20+
args := os.Args[1:]
2221
manager := manager.New()
2322

2423
manager.Initialize()
@@ -29,7 +28,7 @@ func main() {
2928
Argumented(args, manager)
3029
return
3130
}
32-
31+
3332
Walk(manager)
3433
}
3534

@@ -46,40 +45,40 @@ func DisplayHelp() {
4645
}
4746

4847
func RandomRepo(man manager.Manager) {
49-
rpwd,url := prompter.Random(&man)
48+
rpwd, url := prompter.Random(&man)
5049

5150
DisplayRepoWithPath(url, rpwd)
5251
}
5352

5453
func SurpriseRepo(man manager.Manager) {
55-
favourites := favourite.NewFromCache(CACHE_KEY)
54+
favourites := favourite.NewFromCache(CACHE_KEY)
5655

5756
if len(favourites.GetChildren()) == 0 {
5857
RandomRepo(man)
5958
}
6059

61-
category := favourites.GetRandom()
60+
category := favourites.GetRandom()
6261
subcategory := category.GetRandom()
63-
rpwd,url := prompter.Surprise(&man, category.GetName(), subcategory.GetName())
62+
rpwd, url := prompter.Surprise(&man, category.GetName(), subcategory.GetName())
6463

6564
DisplayRepoWithPath(url, rpwd)
6665
}
6766

6867
func Reset(man manager.Manager) {
69-
favourites := favourite.New(CACHE_KEY)
68+
favourites := favourite.New(CACHE_KEY)
7069
favourites.SaveCache()
7170
fmt.Println("The choice list has been cleared.")
7271
}
7372

7473
func Profile(man manager.Manager) {
75-
favourites := favourite.NewFromCache(CACHE_KEY)
74+
favourites := favourite.NewFromCache(CACHE_KEY)
7675
fmt.Println("")
7776
fmt.Println("Your choices:")
7877

79-
for _,category := range favourites.GetChildren() {
78+
for _, category := range favourites.GetChildren() {
8079
fmt.Println("", category.GetName())
8180

82-
for _,subcategory := range category.GetChildren() {
81+
for _, subcategory := range category.GetChildren() {
8382
fmt.Println(" ", subcategory.GetName())
8483
}
8584
}
@@ -93,7 +92,7 @@ func DisplayRepoWithPath(url string, path []string) {
9392
}
9493

9594
fmt.Println(url)
96-
95+
9796
prompter.OpenInBrowser(url)
9897
}
9998

@@ -107,31 +106,31 @@ func Argumented(param []string, man manager.Manager) {
107106
SurpriseRepo(man)
108107
return
109108
}
110-
109+
111110
if param[0] == "help" {
112111
DisplayHelp()
113112
return
114113
}
115-
114+
116115
if param[0] == "reset" {
117116
Reset(man)
118117
return
119118
}
120-
119+
121120
if param[0] == "profile" {
122121
Profile(man)
123122
return
124123
}
125124
}
126125

127126
func Walk(man manager.Manager) {
128-
cursor := man.Root
129-
i := 0
127+
cursor := man.Root
128+
i := 0
130129
favourites := favourite.NewFromCache(CACHE_KEY)
131-
firstsel := ""
130+
firstsel := ""
132131

133132
for {
134-
prompt := prompter.Create(cursor.Name, cursor)
133+
prompt := prompter.Create(cursor.Name, cursor)
135134

136135
_, selected, err := prompt.Run()
137136

0 commit comments

Comments
 (0)