lms .cli .courses .syllabus .get
Get a course's syllabus.
usage: python3 -m lms.cli.courses.syllabus.get [-h] [--version]
[--server SERVER]
[--server-type {blackboard,canvas,moodle}]
[--auth-user AUTH_USER]
[--auth-password AUTH_PASSWORD]
[--auth-token AUTH_TOKEN]
[--course COURSE]
Get a course's syllabus.
options:
-h, --help show this help message and exit
--version show program's version number and exit
--course COURSE The course to target for this operation.
server options:
--server SERVER The address of the LMS server to connect to.
--server-type {blackboard,canvas,moodle}
The type of LMS being connected to (this can normally
be guessed from the server address).
authentication options:
--auth-user AUTH_USER
The user to authenticate with.
--auth-password AUTH_PASSWORD
The password to authenticate with.
--auth-token AUTH_TOKEN
The token to authenticate with.
1""" 2Get a course's syllabus. 3""" 4 5import argparse 6import sys 7 8import lms.backend.instance 9import lms.cli.common 10import lms.cli.parser 11 12def run_cli(args: argparse.Namespace) -> int: 13 """ Run the CLI. """ 14 15 config = args._config_info.application_config 16 backend = lms.backend.instance.get_backend(config) 17 18 course_query = lms.cli.common.check_required_course(backend, config) 19 if (course_query is None): 20 return 1 21 22 syllabus = backend.courses_syllabus_get(course_query) 23 24 if (syllabus is None): 25 print(f"<No syllabus found for course: '{course_query}'.>") 26 else: 27 print(syllabus) 28 29 return 0 30 31def main() -> int: 32 """ Get a parser, parse the args, and call run. """ 33 return run_cli(_get_parser().parse_args()) 34 35def _get_parser() -> argparse.ArgumentParser: 36 """ Get the parser. """ 37 38 parser = lms.cli.parser.get_parser(__doc__.strip(), 39 include_course = True, 40 ) 41 42 return parser 43 44if (__name__ == '__main__'): 45 sys.exit(main())
def
run_cli(args: argparse.Namespace) -> int:
13def run_cli(args: argparse.Namespace) -> int: 14 """ Run the CLI. """ 15 16 config = args._config_info.application_config 17 backend = lms.backend.instance.get_backend(config) 18 19 course_query = lms.cli.common.check_required_course(backend, config) 20 if (course_query is None): 21 return 1 22 23 syllabus = backend.courses_syllabus_get(course_query) 24 25 if (syllabus is None): 26 print(f"<No syllabus found for course: '{course_query}'.>") 27 else: 28 print(syllabus) 29 30 return 0
Run the CLI.
def
main() -> int:
32def main() -> int: 33 """ Get a parser, parse the args, and call run. """ 34 return run_cli(_get_parser().parse_args())
Get a parser, parse the args, and call run.