aplus/main.go

46 lines
811 B
Go
Raw Normal View History

2023-10-27 19:02:38 -04:00
package main
import (
2023-11-14 22:42:25 -05:00
"fmt"
2023-10-27 19:02:38 -04:00
"net/http"
"os"
"github.com/pborman/getopt"
2023-10-27 19:02:38 -04:00
)
var base_link string
2023-11-14 18:04:29 -05:00
var base_aplus_link string
var token string
var external_tools_code int
var client http.Client
2023-10-27 19:02:38 -04:00
func main() {
initialize()
2023-11-04 01:55:30 -04:00
code := getopt.StringLong("code", 'c', "", "Code to enter")
course := getopt.IntLong("course", 'C', -1, "Canvas course number")
list_all := getopt.BoolLong("list-all", 0, "List all courses")
list_favorites := getopt.BoolLong("list-favorites", 0, "List favorite courses")
help := getopt.BoolLong("help", 0, "Help")
getopt.Parse()
2023-10-30 17:58:38 -04:00
if *help {
getopt.Usage()
os.Exit(0)
}
2023-11-14 22:42:25 -05:00
if *list_all {
list_all_courses()
}
if *list_favorites {
list_favorite_courses()
}
if *code != "" && *course != -1 {
fmt.Printf("%d %s", *course, *code)
submit_code(*course, *code)
}
2023-11-04 01:55:30 -04:00
}