Comments (4)
Looks like I can use jq -s
. I'm getting some errors but I can fix that. Thanks for the help!
from rich-cli.
You can format command output, as proven by your echo example. So I do not think that this is a problem with Rich.
I don't have access to the mosquitto_sub command, but I assume the problem is that it does not output a complete JSON document and close STDOUT. For example, tail -f
does not work either, because it produces continuous output and never closes the file, so this example hangs forever:
$ echo '{"test":"OK"}' | tee foo.json
{"test":"OK"}
$ tail -f foo.json | rich --json -
[No output]
As long as the command that you execute finishes, and closes the pipe, you can format the output with Rich. If it doesn't, you can't. And since JSON specifically will be invalid if you don't have the entire file, it's not really technically possible to try to do anything different.
(This is in contrast with JSON Lines, JSONL, which you could certainly stream one line at a time.)
from rich-cli.
Thanks, I did not think that streaming JSON would be different from a normal JSON.
(This is in contrast with JSON Lines, JSONL, which you could certainly stream one line at a time.)
Does Rich CLI support this?
from rich-cli.
As far as I can tell, rich-cli does not support JSONL. See also: #59
I don't believe it would be very difficult to add if there is enough interest. However, it's easy to convert JSONL to JSON with jq -s
so that's what I would recommend. 😊
from rich-cli.
Related Issues (20)
- List of every supported filename extensions HOT 2
- Feature request: support setting `--hyperlinks` via the `RICH_HYPERLINKS` environment variable HOT 3
- --width / --max-width in SVG export don't affect the width of the picture HOT 1
- head / tail operations are slow on larger files
- Provide help for pager
- No lexer fo csv HOT 4
- Multiple emoji encoding issues on Windows HOT 3
- feature request: pv equivalent progress bar (using --size) feature HOT 4
- Rich capturing mouse movements from stdin
- Rich as a drop-in replacement for "more"/"less" HOT 1
- Reused option name: -j is used for both JSON and emoji options HOT 2
- Unable to install latest textual and rich-cli together
- Align title to the left in markdown HOT 2
- Feature request: Allow tailing a CSV HOT 2
- `rich --print` always adds an extra newline
- How to set background color inside strings should be documented better HOT 1
- Exposing Text.from_ansi in rich-cli HOT 1
- Feature request: horizontal padding HOT 1
- please detect encoding before opening a file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rich-cli.