diff options
| author | Juan Roig <jaroig@outlook.com> | 2023-11-14 22:42:25 -0500 |
|---|---|---|
| committer | Juan Roig <jaroig@outlook.com> | 2023-11-14 22:42:25 -0500 |
| commit | e28dc923074ff7445d23cb97a04233f6192a69be (patch) | |
| tree | 39a3076839b9d79e4e8dbce40280e8943abf11cc /main.go | |
| parent | 329f8dfe029025d591cf3e111dc842a7f4c2a43f (diff) | |
Add flags, update README
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 25 |
1 files changed, 22 insertions, 3 deletions
| @@ -1,6 +1,8 @@ | |||
| 1 | package main | 1 | package main |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "flag" | ||
| 5 | "fmt" | ||
| 4 | "net/http" | 6 | "net/http" |
| 5 | ) | 7 | ) |
| 6 | 8 | ||
| @@ -13,8 +15,25 @@ var client http.Client | |||
| 13 | func main() { | 15 | func 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 | } |
