Skip to content

Commit ed3cc6a

Browse files
committed
Added ability to parse usernames from CLI
1 parent 3c593f3 commit ed3cc6a

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

main.go

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package main
22

33
import (
4-
"bufio"
5-
"fmt"
4+
"flag"
65
"iamargus95/fetchGithubData/githubapi"
76
"iamargus95/fetchGithubData/io"
8-
"os"
97
"strings"
108
"sync"
119
)
1210

1311
func main() {
14-
15-
usernames := getUsername()
12+
flag.Parse()
13+
usernames := flag.Args()
1614

1715
var wg sync.WaitGroup
1816
dataToFile := make(chan []string)
@@ -26,15 +24,6 @@ func main() {
2624
wg.Wait()
2725
}
2826

29-
func getUsername() []string {
30-
fmt.Println("\nEnter the desired GitHub usernames separated by a space and press enter : ")
31-
reader := bufio.NewReader(os.Stdin)
32-
input, _ := reader.ReadString('\n')
33-
input = strings.TrimSuffix(input, "\n")
34-
argString := strings.Split(input, " ")
35-
return argString
36-
}
37-
3827
func worker(username string, dataToFile chan []string, wg *sync.WaitGroup) {
3928

4029
defer wg.Done()

0 commit comments

Comments
 (0)