Conversation
| status_err!("Can't convert chain info to JSON: {}", err); | ||
| std::process::exit(1); | ||
| }); | ||
| print!("{}", info) |
There was a problem hiding this comment.
Two things: the _IBC directory is included in the list but it's not a chain; we need to filter it out. Also, could we format it like you did with the other list command where it doesn't show up inside of JSON brackets (and without quotes)? currently it looks like:
[
"_IBC",
"agoric",
"akash",
"arkh",
"assetmantle",
...
vs.
agoric
akash
arkh
assetmantle
...
| let mut serialize = serde_json::Serializer::with_formatter(buf, formatter); | ||
| info.serialize(&mut serialize).unwrap(); | ||
|
|
||
| println!("{}", String::from_utf8(serialize.into_inner()).unwrap()); |
There was a problem hiding this comment.
You can remove the quotes with String.remove()
| println!("{}", String::from_utf8(serialize.into_inner()).unwrap()); | |
| println!("{}", info.remove("\"", ""); |
There was a problem hiding this comment.
Great, thank you
| abscissa_tokio::run(&APP, async { | ||
| match ocular::chain::registry::list_chains().await { | ||
| Ok(mut info) => { | ||
| info.drain(0..1); |
There was a problem hiding this comment.
Since we can't guarantee the first element will always need to be removed, and that there aren't other folders that should be removed, I think a better approach would be a const ignore-list that can be checked when iterating.
There was a problem hiding this comment.
Well, with the format on cosmos/chain-registry, IBC is always the first value.
| let info = info.as_str(); | ||
| let buf = Vec::new(); | ||
| let formatter = serde_json::ser::PrettyFormatter::with_indent(b" "); | ||
| let mut serialize = serde_json::Serializer::with_formatter(buf, formatter); | ||
| info.serialize(&mut serialize).unwrap(); |
There was a problem hiding this comment.
I'm not sure what this is accomplishing; I don't see any formatting changes when I run the command. I think it can be simplified to an iterator filter and foreach for printing.
There was a problem hiding this comment.
Did you remove it before coming to this conclusion?
There was a problem hiding this comment.
Ooh, I didn't see this part:
I think it can be simplified to an iterator filter and foreach for printing
I thought you meant we should continue with serde_json::to_string_pretty because that doesn't print very good. However, since we already use the above for the show command, I'll make it a function to avoid repetition
This closes #37