Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Technik
topicmanager
Commits
cb26db20
Commit
cb26db20
authored
Dec 06, 2021
by
Jakob Lerch
Committed by
satan
Dec 06, 2021
Browse files
refactor(cli): put `pad to mail` to the right place in the code
parent
c50685a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
topicmanager/cli/pad_to_gitlab_and_mail.py
View file @
cb26db20
...
...
@@ -9,6 +9,7 @@ import topicmanager.mail as mail
import
topicmanager.hedgedoc
as
hedgedoc
from
typer
import
Option
,
echo
,
run
def
main
(
gitlab_url
:
str
=
Option
(...,
envvar
=
"GITLAB_URL"
),
gitlab_token
:
str
=
Option
(...,
envvar
=
"GITLAB_TOKEN"
),
...
...
@@ -36,9 +37,18 @@ def main(
template
=
Template
(
mail_template_path
.
read_text
())
# pad to mail
hd
=
hedgedoc
.
HedgedocNote
(
hedgedoc_url
)
tl
=
deepl
.
Translator
(
translator_key
)
protocol_german
=
hd
.
read_note
()
protocol_english
=
tl
.
translate_text
(
protocol_german
,
source_lang
=
"DE"
,
target_lang
=
"EN"
)
body
=
template
.
substitute
(
date
=
meeting_date
,
time
=
meeting_time
protocol_german
=
protocol_german
,
protocol_english
=
protocol_english
)
m
=
mail
.
Mail
(
...
...
@@ -50,25 +60,10 @@ def main(
smtp_password
)
m
.
send_mail
(
body
,
mail_subject
)
hd
=
hedgedoc
.
HedgedocNote
(
hedgedoc_url
)
tl
=
deepl
.
Translator
(
translator_key
)
protocol_german
=
hd
.
read_note
()
# to gitlab
# TODO: parsing
# to mail
protocol_english
=
tl
.
translate_text
(
protocol_german
,
source_lang
=
"DE"
,
target_lang
=
"EN"
)
mail_text
=
apply_proto_mail_template
(
protocol_german
,
protocol_english
)
m
.
send_mail
(
mail_text
,
"Protocol Tech Meeting "
+
meeting_date
)
# pad to gitlab
# TODO
if
__name__
==
"__main__"
:
run
(
main
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment