comparison libervia/cli/cmd_list.py @ 4272:89a0999884ac

cli (list/set): add "--comments" argument.
author Goffi <goffi@goffi.org>
date Thu, 20 Jun 2024 14:46:55 +0200
parents 47401850dec6
children
comparison
equal deleted inserted replaced
4271:a5d27f69eedb 4272:89a0999884ac
99 choices=("auto", "true", "false"), 99 choices=("auto", "true", "false"),
100 default="auto", 100 default="auto",
101 help=_("update existing item instead of replacing it (DEFAULT: auto)"), 101 help=_("update existing item instead of replacing it (DEFAULT: auto)"),
102 ) 102 )
103 self.parser.add_argument( 103 self.parser.add_argument(
104 "-C",
105 "--comments",
106 choices=("auto", "true", "false"),
107 default="auto",
108 help=_("create comments node (DEFAULT: auto)"),
109 )
110 self.parser.add_argument(
104 "item", 111 "item",
105 nargs="?", 112 nargs="?",
106 default="", 113 default="",
107 help=_("id, URL of the item to update, or nothing for new item"), 114 help=_("id, URL of the item to update, or nothing for new item"),
108 ) 115 )
119 126
120 for field_data in self.args.fields: 127 for field_data in self.args.fields:
121 values.setdefault(field_data[0], []).extend(field_data[1:]) 128 values.setdefault(field_data[0], []).extend(field_data[1:])
122 129
123 extra = {"update": update} 130 extra = {"update": update}
131 if self.args.comments != "auto":
132 extra["comments"] = bool(self.args.comments)
124 133
125 try: 134 try:
126 item_id = await self.host.bridge.list_set( 135 item_id = await self.host.bridge.list_set(
127 self.args.service, 136 self.args.service,
128 self.args.node, 137 self.args.node,