Been using this a while to pull out a bunch of server stats for a monitoring dashboard and it's been great. I just wish there were more supported services. The total mess of different outputs and config types for Linux packages is extremely annoying to deal with.
JC – JSONifies the output of many CLI tools
121–130 of 136 posts
Re: JC – JSONifies the output of many CLI tools
#122There are at least 3 ways this can create bugs: - It has to parse output of commands which may or may not be intended to be parsed and may or may not have a predictable format. The only way to overcome this is if this program becomes one of the Big Four "UN*X command output -> data" converters - It casts things to "float/int" - Depending on who made this library, the output itself may not be strict / predictable. Per…
The casting to int/float is not done unless the underlying values are predictably documented to be numbers. There are rare cases where auto int/float conversions are done, but:
1) This is always documented, and
2) You can turn this functionality off via the —raw flag
Also, predictable schemas are documented with each parser. (e.g `jc -h —-arp`)
Re: JC – JSONifies the output of many CLI tools
#123Earlier quoted context omitted.
I would wish for jq to be a really generic tool for working with structured data on the commandline, but I have a really hard time figuring out how to do e.g. conditional-based editing etc. Can't get my head around that, and don't find any info about it on the net. Seems even something that just supports SQL (upon JSON) would be better in this regard.
What do you mean by conditional-based editing? I've found its language to be pretty concise and readable, especially with the // operator.
Re: JC – JSONifies the output of many CLI tools
#124Earlier quoted context omitted.
If we're adding standard output fds, maybe it would be a useful time to define any mechanism for consumers of those fds to discern the total ordering of bytes written to the three of them.
WC has a "character" flag that really just counts bytes: $ echo דותן | wc -c 9 Note that each letter is two bytes, and the newline is an additional byte. So you could pipe (or tree) to wc to count bytes. For a hypothetical stdmeta on fd 3, that might look like this (piping stdout to devnull): $ foo 3>&1 > /dev/null | wc -c
There's a separate option for counting characters: -m
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/w...
Re: JC – JSONifies the output of many CLI tools
#125There are at least 3 ways this can create bugs: - It has to parse output of commands which may or may not be intended to be parsed and may or may not have a predictable format. The only way to overcome this is if this program becomes one of the Big Four "UN*X command output -> data" converters - It casts things to "float/int" - Depending on who made this library, the output itself may not be strict / predictable. Per…
What do you mean?
Re: JC – JSONifies the output of many CLI tools
#126Been using this a while to pull out a bunch of server stats for a monitoring dashboard and it's been great. I just wish there were more supported services. The total mess of different outputs and config types for Linux packages is extremely annoying to deal with.
Feel free to open issues on GitHub if you would like to recommend parsers! Also, the latest version of jc supports parsing of /proc files, which may also help.
Re: JC – JSONifies the output of many CLI tools
#127Nushell that hit the front page earlier this week seemed to me to be limited by "compatible" apps, but wrapping all the big ones in a json converter superficially seems like a great solution to me.
Re: JC – JSONifies the output of many CLI tools
#128Earlier quoted context omitted.
There is such a thing as no-stdlib Rust deployments.
which is for MCUs only and is like a bare metal language without any libraries, its use is very limited. all I need is that rust's stdlib can be linked dynamically just like c/c++/java/whatever, if that happens I'm ready to switch to it.
Re: JC – JSONifies the output of many CLI tools
#129Earlier quoted context omitted.
which is for MCUs only and is like a bare metal language without any libraries, its use is very limited. all I need is that rust's stdlib can be linked dynamically just like c/c++/java/whatever, if that happens I'm ready to switch to it.
It seems like you have multiple binaries (otherwise, I don't see how you would save space) in a context without an operating system, but do have abstractions like a linker; throwing this out there, you may be able to sort of fake having dynamically linked binaries with transparent disk compression. The shared code gets compressed, and you trade the overhead of your linker for the overhead of your compression, and pro…
Re: JC – JSONifies the output of many CLI tools
#130Earlier quoted context omitted.
Following the project documentation, you easily come to: jc dig example.com | jq [ { "id": 30081, "opcode": "QUERY", "status": "NOERROR", "flags": [ "qr", "rd", "ra" ], "query_num": 1, "answer_num": 1, "authority_num": 0, "additional_num": 1, "opt_pseudosection": { "edns": { "version": 0, "flags": [], "udp": 4096 } }, "question": { "name": "example.com.", "class": "IN", "type": "A" }, "answer": [ { "name": "example.c…
For me there are too many quotes and brackets. My proposed format can also be converted to JSON if necessary.