CLI to download (course files, videos, etc) & view (deadlines, events, announcements) from Canvas
Brew is a package manager for macOS (or linux) that helps you install packages easily - more info here
To install Brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
To install canvas-sync with Brew:
brew install aidanaden/tools/canvas-sync
Scoop is a package manager for windows that helps you install programs from the command line (Brew but for windows) - more info here
To install Scoop, launch powershell and run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
To install canvas-sync with Scoop:
scoop bucket add scoop-bucket https://github.com/aidanaden/scoop-bucket.git
scoop install canvas-sync
You can also download directly from the releases page
Warning: skip if you don't know what zsh is
Run the following code block to add autocompletion for canvas-sync to your shell.
Code
echo "\n\nif type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi" >> ~/.zshrc && source ~/.zshrc
Code
echo "if type brew &>/dev/null
then
HOMEBREW_PREFIX="$(brew --prefix)"
if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]
then
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
else
for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*
do
[[ -r "${COMPLETION}" ]] && source "${COMPLETION}"
done
fi
fi" >> ~/.bash_profile && source ~/.bash_profile
Code
echo "if test -d (brew --prefix)"/share/fish/completions"
set -gx fish_complete_path $fish_complete_path (brew --prefix)/share/fish/completions
end
if test -d (brew --prefix)"/share/fish/vendor_completions.d"
set -gx fish_complete_path $fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end" >> ~/.config/fish/config.fish && source ~/.config/fish/config.fish
If installed using brew, simply run:
canvas-sync upgrade
If installed using scoop, simply run:
scoop update; scoop update canvas-sync
You can also download the latest version directly from the releases page
To set up canvas-sync, run the init
command:
canvas-sync init
-
First, enter the directory to store all downloaded canvas data (files, videos, etc) e.g.
$HOME/Desktop/canvas
, if left blank all downloaded data will be stored in$HOME/canvas-sync/data
-
Next, enter your school's canvas website url, if left blank it'll be set to
https://canvas.nus.edu.sg
(i'm from nus after all) -
You'll be asked for your username and password to log in to canvas (required for video downloads)
-
After logging in, your config will be successfully created and all other commands will work, check them out here
All configuration is done in the $HOME/canvas-sync/config.yaml
file.
4 values can be configured:
- data_dir: directory to store downloaded canvas data, defaults to
$HOME/canvas-sync/data
- canvas_url: URL of your target canvas site, defaults to
https://canvas.nus.edu.sg
- canvas_username: your canvas site username
- canvas_password: your canvas site password
- access_token (DO NOT EDIT): token generated by the
init
command to download from canvas directly, if not filled you'll need to runcanvas-sync init
To create a config file, run canvas-sync init
Creates a new config file in the default directory $HOME/canvas-sync
Downloads data (files, videos, etc) from canvas, overwrites all existing data
View documentation via pull files -h
View documentation via pull videos -h
Updates downloaded data (files, videos, etc) from canvas
View documentation via update files -h
View documentation via update videos -h
Display data from canvas (deadlines, events, announcements, etc)
Display past/future assignment deadlines
Display past/future lectures/announcements
Display people from a given course code
What is this $HOME thing?
It's the main directory of the current user. For mac/linux it'll be `/Users/`, for windows it'll be `C:\Users\`It doesn't work for my university
This tool was built by an NUS student (me), hence i'm not able to test it with canvas sites from any other university. Please create an issue at https://github.com/aidanaden/canvas-sync/issues regarding any problems you face with your school's canvas website. Thank you! :)Is my username/password stored anywhere?
No, we do not store any credentials. When running the `init` command, the tool logs in to your canvas website and creates an access token that allows the tool to access your canvas data on your behalf.If there are any other questions, please create an issue here, if it's a common enough issue i'll add it to the FAQ section here :)
MIT