Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
download in the examples printing too much info #22
I used the example code for DOWNLOAD option and the download is properly done, but there are a bunch of prints being outputted to terminal like this example:
It would be better to have some nice output like the one shown in the examples with a progress bar than a lot of prints in each state.
Finally, to escape this, I had to press "ctrl+c" on the console in order to be able to continue inputing new code.
This is also something I've encountered, but never looked into "fixing".
It shouldn't be too hard to take this json object stream of status data and turn it into a nice loading CLI spinner + progress status/bar or something, using
However, the lower level object stream is still required for use within Node, and it only makes sense to do
I would suggest we put together a standard form (i.e. json-schema) for "in progress JSON objects", and build a "logger" that wraps on top and has nice spinner/progress indicator.
Another option could be, have the "logger" tool take
I think last option is probably the best. The options for "user friendly mode" could simply
The freezing is probably from the process not exiting after stream completes (I think it might actually be a duplex stream which is why it doesn't end - because
If you comment line 409 and change
The freezing does not occur if I do not use an interactive section of node, i.e., if I just run something like:
From a reusability point of view, I think bionode tools should always use NDJSON for STDIN and STDOUT. This standard allows developers to easily combine code and write pipelines. But from a UX point of view, it's sometimes ugly and confusing.
I think the general approach to solving this should be @thejmazz last example. That is, piping the NDJSON output to another tool that prettifies it, without modifying
However, in this particular case (as @tiagofilipe12 pointed out)
I'm happy to have a look at a PR that implements that feature.
BTW, you can also just get the progress percentage on the same line with a bit of BASH scripting.
bionode-ncbi download assembly guillardia theta | json -ga progress | while read i; do echo -ne "\r$i"; done