From 9221051daefc9f8ee5ecf31a3f6974ee3965869c Mon Sep 17 00:00:00 2001 From: vin Date: Tue, 16 Jan 2024 15:23:35 -0500 Subject: [PATCH] update readme to the current status of the project --- README.md | 41 +++++++++++++++++++++++++++++++++++++---- canvas.go | 2 +- main.go | 2 +- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d74cbad..c76a9a7 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,39 @@ -# aplus command line utility +# A+Attendance CLI -This is an cli utility initially created for students at Florida Polytechnic University to submit their aplus codes. -In time, we intend to generalize this utility to all universities. -In the meantime however, any students from other universities wishing to use the utility may change the instance_url (the main URL you see before the / when you use Canvas) variables. +This is a CLI utility initially created for students at Florida Polytechnic University to submit their A+ attendance codes, but can be used for other +universities using Canvas and A+Attendance. + +## Building/Installing + +To compile this program, you need `go` installed as well as need to set two +environment variables in your shell's configuration file (like `~/.profile` or it's rc file) for your Canvas instance URL and your account's API key. + +### Getting an API key + +When logged into your university's Canvas site, go to Account -> Settings -> New Access Token -> (give any name or expiration date) -> store the Token somewhere. + +### Setting the Environment Variables + +In your shell's configuration file, add: +```sh +export CANVAS_INSTANCE="https://youruniversityhere.instructure.com" +export CANVAS_API_KEY="the_canvas_access_token_you_stored_somewhere" + +# below not needed if go is already setup +export GOPATH=$HOME/.local/go +export GOBIN=$GOPATH/bin +export PATH=$PATH:$GOBIN +``` + +### Installing + +Simply run `go install codeberg.org/flpolyaplus/aplus@latest`. ## Usage +### Show help message +`aplus --help` + ### List all courses and canvas course codes `aplus --list-all` @@ -15,6 +43,11 @@ In the meantime however, any students from other universities wishing to use the ### Enter code for a specified course `aplus --code --course ` +If no course is specified, the code is tried on all active courses. + +### Show timetable for a specified course +`aplus --timetable --course ` + ## Mirrors [Codeberg](https://codeberg.org/flpolyaplus/aplus/) diff --git a/canvas.go b/canvas.go index 7020658..f1a2375 100644 --- a/canvas.go +++ b/canvas.go @@ -14,7 +14,7 @@ import ( ) func initialize() { - instance_url := "https://floridapolytechnic.instructure.com" + instance_url := os.Getenv("CANVAS_INSTANCE") base_link = instance_url + "/api/v1" token = os.Getenv("CANVAS_API_KEY") jar, _ := cookiejar.New(&cookiejar.Options{ diff --git a/main.go b/main.go index cd110ad..c3fe1a5 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ func usage() { fmt.Println(" -t, --timetable\tlists the class sessions in a course") fmt.Println(" -v, --verbose\tprints with verbose output") fmt.Println(" -h, --help\tdisplays this help message") - fmt.Println(" -p, --profile\twrites cpu profile to a file") + fmt.Println(" -p, --profile\twrites cpu profile to a file (for debugging/optimizing)") } func main() {