canvas-sync

command module
v1.27.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 1 Imported by: 0

README

canvas-sync

CLI to download (course files, videos, etc) & view (deadlines, events, announcements) from Canvas

Contents

Install

Brew (mac/linux/wsl)

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 (windows)

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

Autocomplete (mac/linux/wsl)

Warning: skip if you don't know what zsh is

Run the following code block to add autocompletion for canvas-sync to your shell.

zsh
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

bash
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
fish (not necessary if you installed fish via homebrew)
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
Updating
Brew

If installed using brew, simply run:

canvas-sync upgrade
Scoop

If installed using scoop, simply run:

scoop update; scoop update canvas-sync

You can also download the latest version directly from the releases page

Set-up

To set up canvas-sync, run the init command:

canvas-sync init

init completed

  1. 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

  2. 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)

  3. You'll be asked for your username and password to log in to canvas (required for video downloads)

  4. After logging in, your config will be successfully created and all other commands will work, check them out here

Config

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 run canvas-sync init

To create a config file, run canvas-sync init

Commands

Init

Creates a new config file in the default directory $HOME/canvas-sync

init

Pull

Downloads data (files, videos, etc) from canvas, overwrites all existing data

Pull Files

pull files demo

View documentation via pull files -h

Pull Videos

pull videos demo

View documentation via pull videos -h

Update

Updates downloaded data (files, videos, etc) from canvas

Update Files

update files demo

View documentation via update files -h

Update Videos

update videos demo

View documentation via update videos -h

View

Display data from canvas (deadlines, events, announcements, etc)

View Deadlines (assignments)

Display past/future assignment deadlines

view deadlines demo

View Events (Announcements/lectures/tutorials)

Display past/future lectures/announcements

view events demo

View People (from a given course)

Display people from a given course code

view people demo

FAQ

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 :)

LICENSE

MIT

Documentation

Overview

Copyright © 2023 ryan aidan [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL