Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds announcements module with announment related commands #86

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions src/canvaslms/cli/announcements.nw
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
\chapter{Announcements}

In this chapter we will focus on announcements.
We want to provide a command to post announcements, list announcements (titles)
and read a specific announcement (title and body).


\section{Module outline}

We outline the module:
<<announcements.py>>=
import argparse
import canvasapi
import canvaslms.cli.courses as courses
import canvaslms.hacks.canvasapi
import csv
import os
import re
import rich.console
import rich.markdown
import sys

<<functions>>

def add_command(subp):
"""
Adds the subcommands announcements, announcement and announce to argparse
parser subp
"""
add_announcements_command(subp)
add_announcement_command(subp)
add_announce_command(subp)

def add_announcements_command(subp):
"""Adds the announcements subcommand to argparse parser subp"""
<<add announcements command to subp>>

def add_announcement_command(subp):
"""Adds the announcement subcommand to argparse parser subp"""
<<add announcement command to subp>>

def add_announce_command(subp):
"""Adds the announce subcommand to argparse parser subp"""
<<add announce command to subp>>
@


\section{Filtering announcements on the command line}

<<functions>>=
def add_announcement_title_option(parser, required=False):
<<set up options for announcement based on title>>

def process_announcement_title_option(canvas, args):
<<process options for selecting announcement based on title>>
return list(announcements_list)
@