summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJuan Roig <jaroig@outlook.com>2023-11-14 22:42:25 -0500
committerJuan Roig <jaroig@outlook.com>2023-11-14 22:42:25 -0500
commite28dc923074ff7445d23cb97a04233f6192a69be (patch)
tree39a3076839b9d79e4e8dbce40280e8943abf11cc /main.go
parent329f8dfe029025d591cf3e111dc842a7f4c2a43f (diff)
Add flags, update README
Diffstat (limited to 'main.go')
-rw-r--r--main.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/main.go b/main.go
index 6e4205e..61bf20f 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,8 @@
1package main 1package main
2 2
3import ( 3import (
4 "flag"
5 "fmt"
4 "net/http" 6 "net/http"
5) 7)
6 8
@@ -13,8 +15,25 @@ var client http.Client
13func main() { 15func main() {
14 initialize() 16 initialize()
15 17
16 course_code := 7326 18 code := flag.String("code", "", "Code to enter")
17 submit_code(course_code, "A1B2C") 19 course := flag.Int("course", -1, "Canvas course number")
20 list_all := flag.Bool("list-all", false, "List all courses")
21 list_favorites := flag.Bool("list-favorites", false, "List favorite courses")
18 22
19 // enter_code() 23 flag.Parse()
24
25 if *list_all {
26 list_all_courses()
27 }
28
29 if *list_favorites {
30 list_favorite_courses()
31 }
32
33 if *code != "" && *course != -1 {
34 fmt.Printf("%d %s", *course, *code)
35 submit_code(*course, *code)
36 }
37
38 submit_code(7329, "asdkl")
20} 39}