mirror of
https://codeberg.org/flpolyaplus/aplus.git
synced 2024-11-21 17:00:30 -05:00
46 lines
901 B
Go
46 lines
901 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
|
|
"github.com/pborman/getopt"
|
|
)
|
|
|
|
var base_link string
|
|
var base_aplus_link string
|
|
var token string
|
|
var external_tools_code int
|
|
var client http.Client
|
|
|
|
func main() {
|
|
initialize()
|
|
|
|
code := getopt.StringLong("code", 'c', "", "Code to enter")
|
|
course := getopt.IntLong("course", 'C', -1, "Canvas course number")
|
|
list_all := getopt.BoolLong("list-all", 'L', "List all courses")
|
|
list_favorites := getopt.BoolLong("list-favorites", 'F', "List favorite courses")
|
|
help := getopt.BoolLong("help", 'h', "Help")
|
|
|
|
getopt.Parse()
|
|
|
|
if *help || (*list_all == false && *list_favorites == false && *code == "" && *course == -1) {
|
|
getopt.Usage()
|
|
os.Exit(0)
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|