# HG changeset patch # User Goffi # Date 1727531851 -7200 # Node ID 1795bfcc38e7fdfd280a16cdbed2c8a18aa6fdeb # Parent 8ee369e6eb9969daa3827795623f91aa2ced0972 cli (message/send): add arguments to send keywords and headers: rel 451 diff -r 8ee369e6eb99 -r 1795bfcc38e7 libervia/cli/cmd_message.py --- a/libervia/cli/cmd_message.py Sat Sep 28 15:57:03 2024 +0200 +++ b/libervia/cli/cmd_message.py Sat Sep 28 15:57:31 2024 +0200 @@ -95,6 +95,24 @@ 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 @@ 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 @@ if addresses: extra["addresses"] = addresses + if self.args.keywords: + extra["keywords"] = self.args.keywords + to_send = [] error = False