mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
busctl: add introspect --xml-interface
This wraps the call to org.freedesktop.DBus.Introspectable.Introspect. Using "busctl call" directly is inconvenient because busctl escapes the string before printing. Example: $ busctl introspect --xml org.freedesktop.systemd1 /org/freedesktop/systemd1 | pygmentize -lxml | less -RF
This commit is contained in:
parent
d603324b4b
commit
d5c8d8233c
@ -140,6 +140,16 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--xml-interface</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>When used with the <command>introspect</command> call, dump the XML description received from
|
||||
the D-Bus <constant>org.freedesktop.DBus.Introspectable.Introspect</constant> call instead of the
|
||||
normal output.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--json=</option><replaceable>MODE</replaceable></term>
|
||||
|
||||
|
@ -50,6 +50,7 @@ static size_t arg_snaplen = 4096;
|
||||
static bool arg_list = false;
|
||||
static bool arg_quiet = false;
|
||||
static bool arg_verbose = false;
|
||||
static bool arg_xml_interface = false;
|
||||
static bool arg_expect_reply = true;
|
||||
static bool arg_auto_start = true;
|
||||
static bool arg_allow_interactive_authorization = true;
|
||||
@ -948,6 +949,12 @@ static int introspect(int argc, char **argv, void *userdata) {
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (arg_xml_interface) {
|
||||
/* Just dump the received XML and finish */
|
||||
puts(xml);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* First, get list of all properties */
|
||||
r = parse_xml_introspect(argv[2], xml, &ops, members);
|
||||
if (r < 0)
|
||||
@ -2255,6 +2262,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
ARG_SIZE,
|
||||
ARG_LIST,
|
||||
ARG_VERBOSE,
|
||||
ARG_XML_INTERFACE,
|
||||
ARG_EXPECT_REPLY,
|
||||
ARG_AUTO_START,
|
||||
ARG_ALLOW_INTERACTIVE_AUTHORIZATION,
|
||||
@ -2284,6 +2292,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
{ "list", no_argument, NULL, ARG_LIST },
|
||||
{ "quiet", no_argument, NULL, 'q' },
|
||||
{ "verbose", no_argument, NULL, ARG_VERBOSE },
|
||||
{ "xml-interface", no_argument, NULL, ARG_XML_INTERFACE },
|
||||
{ "expect-reply", required_argument, NULL, ARG_EXPECT_REPLY },
|
||||
{ "auto-start", required_argument, NULL, ARG_AUTO_START },
|
||||
{ "allow-interactive-authorization", required_argument, NULL, ARG_ALLOW_INTERACTIVE_AUTHORIZATION },
|
||||
@ -2388,6 +2397,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
arg_verbose = true;
|
||||
break;
|
||||
|
||||
case ARG_XML_INTERFACE:
|
||||
arg_xml_interface = true;
|
||||
break;
|
||||
|
||||
case ARG_EXPECT_REPLY:
|
||||
r = parse_boolean(optarg);
|
||||
if (r < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user