cli (message/send): add arguments to send keywords and headers:

rel 451
This commit is contained in:
Goffi 2024-09-28 15:57:31 +02:00
commit 5ccec8f755

View file

@ -95,6 +95,24 @@ class Send(base.CommandBase):
help=_("add a file as an attachment"),
)
self.parser.add_argument(
"-k",
"--keyword",
dest="keywords",
action="append",
help=_("add keyword to message"),
)
self.parser.add_argument(
"-H",
"--header",
dest="headers",
action="append",
nargs=2,
metavar=("NAME", "VALUE"),
help=_("add header metadata"),
)
addressing_group = self.parser.add_argument_group(
"addressing commands",
description="Commands to add addressing metadata, and/or to send message to "
@ -149,6 +167,9 @@ class Send(base.CommandBase):
extra[key] = clean_ustr("".join(stdin_lines))
stdin_lines = []
if self.args.headers:
extra["headers"] = dict(self.args.headers)
addresses = {}
for arg_name in RECIPIENTS_ARGS + [a.replace("-", "_") for a in REPLY_ARGS]:
values = getattr(self.args, arg_name)
@ -167,6 +188,9 @@ class Send(base.CommandBase):
if addresses:
extra["addresses"] = addresses
if self.args.keywords:
extra["keywords"] = self.args.keywords
to_send = []
error = False