changeset 3825:10a4846818e5

CLI (identity): add description to `identity set`: rel 368
author Goffi <goffi@goffi.org>
date Wed, 29 Jun 2022 12:13:49 +0200
parents 6329ee6b6df4
children 81c79b7cafa7
files sat_frontends/jp/cmd_identity.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_identity.py	Wed Jun 29 12:12:09 2022 +0200
+++ b/sat_frontends/jp/cmd_identity.py	Wed Jun 29 12:13:49 2022 +0200
@@ -72,15 +72,24 @@
             "-n",
             "--nickname",
             action="append",
+            metavar="NICKNAME",
             dest="nicknames",
-            required=True,
             help=_("nicknames of the entity"),
         )
+        self.parser.add_argument(
+            "-d",
+            "--description",
+            help=_("description of the entity"),
+        )
 
     async def start(self):
-        id_data = {
-            "nicknames": self.args.nicknames,
-        }
+        id_data = {}
+        for field in ("nicknames", "description"):
+            value = getattr(self.args, field)
+            if value is not None:
+                id_data[field] = value
+        if not id_data:
+            self.parser.error("At least one metadata must be set")
         try:
             self.host.bridge.identitySet(
                 data_format.serialise(id_data),