machine-readable --query-ip-configuration [patch] (2nd attempt)

Daniel Barlow dan at
Fri Mar 24 21:25:13 UTC 2017

Hi, thanks for your response.

On 24 March 2017 at 09:07, Aleksander Morgado <aleksander at>

> Hey,
> But I didn't think of tab-separated outputs, more maybe something like
> this:
> ipv6.address=2a01:4c8:1b:eb13:2dbf:b045:8a94:88fa/64
> ipv6.gateway=2a01:4c8:1b:eb13:40dc:ba5f:4d43:d4c
> ipv6.dns0=2a01:4c8:f000:1::1
> ipv6.dns1= 2a01:4c8:f000:1::2
> mtu=1500

That seems like a simple-enough change (and makes it much easier to do a
hacky parser if you don't mind using the `eval` shell builtin).  I guess
you would want the right hand side to be quoted if it contains spaces or
shell special characters?  I don't know offhand if any of the programs is
likely to produce output with special characters in it. so I may be
worrying prematurely there.

>I've seen other attempts to do this using e.g.

> JSON formatted output, but I never liked that for integration of CLIs
> in shell scripts.

Yes, I considered and rejected JSON (and its brother YAML) for the same
reason.  Shell-friendliness implies something line-based, imo

> And also, there has to be a way of querying which would be the
> possible output fields that a command may generate, so that when
> you're developing based on the CLI outputs, you can know in advance
> which fields you may receive as output without needing to look at the
> source code. Something like:
> $ mbimcli --query-ip-configuration --machine-readable-help

I was going to go a bit more low-ceremony here, and embed the metadata
fields in with the data.  So you might get something like

ipv6.dns= 2a01:4c8:f000:1::2

Would that work for your use case?

> Maybe mbimcli is the best candidate to start adding support for this,

> as I think it's the simplest of the CLIs for now.

mbimcli is certainly the most relevant for me as it's the only one I can
test with actual hardware ;-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the libmbim-devel mailing list