Compare commits

...

4 Commits

Author SHA1 Message Date
Adam Blažek e64c2e9c59 1.5.0 2020-09-29 09:12:22 +02:00
Adam Blažek ecdce60091 Merge branch 'messages' into master 2020-09-29 09:12:03 +02:00
Adam Blažek 02addb3db9 Messages display correctly 2020-09-29 09:08:59 +02:00
Adam Blažek 13919442ec Basic messages, needs HTML parsing 2020-09-27 12:22:14 +02:00
2 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "1.4.0"
version = "1.5.0"
author = "Adam Blažek"
description = "CLI client for Bakaláři"
license = "GPL-3.0"

View File

@ -1,5 +1,5 @@
import json, net, options, os, strscans, times, unicode, uri
from strutils import ffDecimal, formatFloat
import htmlparser, json, net, options, os, strscans, times, unicode, uri, xmltree
from strutils import ffDecimal, formatFloat, replace
import cligen, colorize, elvis
from bakalari as baka import Grade, newBakalari
@ -106,6 +106,17 @@ proc homework(
stdout.writeLine homework.teacher.fgLightMagenta
stdout.writeLine homework.content
proc messages(
configFile = defaultConfigFile,
) =
withBakalari(defaultConfigFile):
for message in baka.messages(bakalari):
stdout.writeLine "----------------------------------------------------------------".fgLightGray
stdout.writeLine message.sentTime.format("yyyy-MM-dd") .fgLightCyan
stdout.writeLine message.title.fgLightYellow
stdout.writeLine message.sender.fgLightMagenta
stdout.writeLine message.text.replace("<br />", "{{br}}").parseHtml.innerText.replace("{{br}}", "\n")
proc timetable(
configFile = defaultConfigFile,
date = "",
@ -159,6 +170,9 @@ try:
[homework, help = {
"config-file": "where the credentials are stored",
}],
[messages, help = {
"config-file": "where the credentials are stored",
}],
[timetable, help = {
"config-file": "where the credentials are stored",
"date": "any date inside the week you want to display, in YYYYMMDD format (defaults to today)",