From aa4b0d08a45fc605d4da52657c278c3b358b78e2 Mon Sep 17 00:00:00 2001 From: Daniel Bosk Date: Wed, 7 Jun 2023 20:14:11 +0200 Subject: [PATCH] Adds WIP for announcements module --- src/canvaslms/cli/announcements.nw | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/canvaslms/cli/announcements.nw diff --git a/src/canvaslms/cli/announcements.nw b/src/canvaslms/cli/announcements.nw new file mode 100644 index 0000000..2b674ae --- /dev/null +++ b/src/canvaslms/cli/announcements.nw @@ -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: +<>= +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 + +<> + +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""" + <> + +def add_announcement_command(subp): + """Adds the announcement subcommand to argparse parser subp""" + <> + +def add_announce_command(subp): + """Adds the announce subcommand to argparse parser subp""" + <> +@ + + +\section{Filtering announcements on the command line} + +<>= +def add_announcement_title_option(parser, required=False): + <> + +def process_announcement_title_option(canvas, args): + <> + return list(announcements_list) +@ +