-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (32 loc) · 851 Bytes
/
Copy pathmain.go
File metadata and controls
41 lines (32 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"log"
"os"
)
func main() {
errorOutput := log.New(os.Stderr, "", 0)
if len(os.Args) < 2 {
errorOutput.Println("No method was passed as CLI argument")
return
}
method := os.Args[1] // login | getTweet
if method == "login" {
if len(os.Args) < 4 {
errorOutput.Println("No cookies file is present or no credentials file is present")
return
}
cookiesFilePath := os.Args[2]
credentialsFilePath := os.Args[3]
login(cookiesFilePath, credentialsFilePath)
} else if method == "getTweet" {
if len(os.Args) < 4 {
errorOutput.Println("No cookies file is present or tweet id was not passed as an argument")
return
}
cookiesFilePath := os.Args[2]
tweetId := os.Args[3]
getTweet(cookiesFilePath, tweetId)
} else {
errorOutput.Println("No such method (from CLI arguments): " + method)
}
}