Mercurial > libervia-backend
annotate libervia/cli/cmd_adhoc.py @ 4272:89a0999884ac
cli (list/set): add "--comments" argument.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 20 Jun 2024 14:46:55 +0200 |
parents | 0d7bb4df2343 |
children |
rev | line source |
---|---|
3137 | 1 #!/usr/bin/env python3 |
2 | |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
4075
47401850dec6
refactoring: rename `libervia.frontends.jp` to `libervia.cli`
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
4 # Libervia CLI |
3479 | 5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org) |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
3028 | 20 from . import base |
4071
4b842c1fb686
refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents:
4037
diff
changeset
|
21 from libervia.backend.core.i18n import _ |
4075
47401850dec6
refactoring: rename `libervia.frontends.jp` to `libervia.cli`
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
22 from libervia.cli.constants import Const as C |
47401850dec6
refactoring: rename `libervia.frontends.jp` to `libervia.cli`
Goffi <goffi@goffi.org>
parents:
4074
diff
changeset
|
23 from libervia.cli import xmlui_manager |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 __commands__ = ["AdHoc"] |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
27 FLAG_LOOP = "LOOP" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
28 MAGIC_BAREJID = "@PROFILE_BAREJID@" |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
30 |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 class Remote(base.CommandBase): |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
33 super(Remote, self).__init__( |
3028 | 34 host, "remote", use_verbose=True, help=_("remote control a software") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
35 ) |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 def add_parser_options(self): |
3028 | 38 self.parser.add_argument("software", type=str, help=_("software name")) |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
39 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
40 "-j", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
41 "--jids", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
42 nargs="*", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
43 default=[], |
3028 | 44 help=_("jids allowed to use the command"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
45 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
46 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
47 "-g", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
48 "--groups", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
49 nargs="*", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
50 default=[], |
3028 | 51 help=_("groups allowed to use the command"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
52 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
53 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
54 "--forbidden-groups", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
55 nargs="*", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
56 default=[], |
3028 | 57 help=_("groups that are *NOT* allowed to use the command"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
58 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
59 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
60 "--forbidden-jids", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
61 nargs="*", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
62 default=[], |
3028 | 63 help=_("jids that are *NOT* allowed to use the command"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
64 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
65 self.parser.add_argument( |
3028 | 66 "-l", "--loop", action="store_true", help=_("loop on the commands") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
67 ) |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 |
3040 | 69 async def start(self): |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 name = self.args.software.lower() |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 flags = [] |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
72 magics = {jid for jid in self.args.jids if jid.count("@") > 1} |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 magics.add(MAGIC_BAREJID) |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 jids = set(self.args.jids).difference(magics) |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 if self.args.loop: |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 flags.append(FLAG_LOOP) |
3040 | 77 try: |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3568
diff
changeset
|
78 bus_name, methods = await self.host.bridge.ad_hoc_dbus_add_auto( |
3040 | 79 name, |
80 list(jids), | |
81 self.args.groups, | |
82 magics, | |
83 self.args.forbidden_jids, | |
84 self.args.forbidden_groups, | |
85 flags, | |
86 self.profile, | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
87 ) |
3040 | 88 except Exception as e: |
89 self.disp(f"can't create remote control: {e}", error=True) | |
90 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
91 else: | |
92 if not bus_name: | |
93 self.disp(_("No bus name found"), 1) | |
94 self.host.quit(C.EXIT_NOT_FOUND) | |
95 else: | |
96 self.disp(_("Bus name found: [%s]" % bus_name), 1) | |
97 for method in methods: | |
98 path, iface, command = method | |
99 self.disp( | |
4270
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4167
diff
changeset
|
100 _( |
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4167
diff
changeset
|
101 "Command found: (path:{path}, iface: {iface}) [{command}]" |
0d7bb4df2343
Reformatted code base using black.
Goffi <goffi@goffi.org>
parents:
4167
diff
changeset
|
102 ).format(path=path, iface=iface, command=command), |
3040 | 103 1, |
104 ) | |
105 self.host.quit() | |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
107 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
108 class Run(base.CommandBase): |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
109 """Run an Ad-Hoc command""" |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
110 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
111 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
112 super(Run, self).__init__( |
3028 | 113 host, "run", use_verbose=True, help=_("run an Ad-Hoc command") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
114 ) |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
115 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
116 def add_parser_options(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
117 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
118 "-j", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
119 "--jid", |
3028 | 120 default="", |
4167
319a0e47dc8b
plugin ad-hoc D-Bus: fix deprecated use of python-dbus:
Goffi <goffi@goffi.org>
parents:
4075
diff
changeset
|
121 help=_("jid of the service (default: profile's server)"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
122 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
123 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
124 "-S", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
125 "--submit", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
126 action="append_const", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
127 const=xmlui_manager.SUBMIT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
128 dest="workflow", |
3028 | 129 help=_("submit form/page"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
130 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
131 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
132 "-f", |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
133 "--field", |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
134 action="append", |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
135 nargs=2, |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
136 dest="workflow", |
3028 | 137 metavar=("KEY", "VALUE"), |
138 help=_("field value"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
139 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
140 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
141 "node", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
142 nargs="?", |
3028 | 143 default="", |
144 help=_("node of the command (default: list commands)"), | |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
145 ) |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
146 |
3040 | 147 async def start(self): |
148 try: | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3568
diff
changeset
|
149 xmlui_raw = await self.host.bridge.ad_hoc_run( |
3040 | 150 self.args.jid, |
151 self.args.node, | |
152 self.profile, | |
153 ) | |
154 except Exception as e: | |
155 self.disp(f"can't get ad-hoc commands list: {e}", error=True) | |
156 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
157 else: | |
158 xmlui = xmlui_manager.create(self.host, xmlui_raw) | |
159 workflow = self.args.workflow | |
160 await xmlui.show(workflow) | |
161 if not workflow: | |
162 if xmlui.type == "form": | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3568
diff
changeset
|
163 await xmlui.submit_form() |
3040 | 164 self.host.quit() |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
165 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
166 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
167 class List(base.CommandBase): |
3368
e86b71b1aa31
core: minor typos, docstring/comments update
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
168 """List Ad-Hoc commands available on a service""" |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
169 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
170 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
171 super(List, self).__init__( |
3028 | 172 host, "list", use_verbose=True, help=_("list Ad-Hoc commands of a service") |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
173 ) |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
174 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
175 def add_parser_options(self): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
176 self.parser.add_argument( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
177 "-j", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
178 "--jid", |
3028 | 179 default="", |
3368
e86b71b1aa31
core: minor typos, docstring/comments update
Goffi <goffi@goffi.org>
parents:
3137
diff
changeset
|
180 help=_("jid of the service (default: profile's server)"), |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
181 ) |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
182 |
3040 | 183 async def start(self): |
184 try: | |
4037
524856bd7b19
massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents:
3568
diff
changeset
|
185 xmlui_raw = await self.host.bridge.ad_hoc_list( |
3040 | 186 self.args.jid, |
187 self.profile, | |
188 ) | |
189 except Exception as e: | |
190 self.disp(f"can't get ad-hoc commands list: {e}", error=True) | |
191 self.host.quit(C.EXIT_BRIDGE_ERRBACK) | |
192 else: | |
193 xmlui = xmlui_manager.create(self.host, xmlui_raw) | |
194 await xmlui.show(read_only=True) | |
195 self.host.quit() | |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
196 |
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
197 |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
198 class AdHoc(base.CommandBase): |
2409
d2ff5ff3de77
jp (ad-hoc): new "list" and "run" commands:
Goffi <goffi@goffi.org>
parents:
1960
diff
changeset
|
199 subcommands = (Run, List, Remote) |
824
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
200 |
c304ce32042b
jp: added ad-hoc subcommand with a remote sub-subcommand to create a D-Bus remote
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
201 def __init__(self, host): |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
202 super(AdHoc, self).__init__( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
203 host, "ad-hoc", use_profile=False, help=_("Ad-hoc commands") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2562
diff
changeset
|
204 ) |