antonmedv / antonmedv/fx

Interactive mode

Ouverte
#305 2 commentaires 12 réactions 0 personnes assignées Voir sur GitHub
feature
Langage dominant
Go
Étoiles
20.6k
Forks
488
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

When viewing JSON in interactive mode, I'd love to be able to dig into arrays of objects by doing `.[]`. For example, in regular processing mode, I can pass a filter to fx on a top level array of objects like the example below, and get back a list of emails. So using this command `curl "https://jsonplaceholder.typicode.com/comments" | fx '.[].email'` will process JSON like this
```json
[
{
"postId": 1,
"id": 1,
"name": "id labore ex et quam laborum",
"email": "Eliseo@gardner.biz",
"body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
},
{
"postId": 1,
"id": 2,
"name": "quo vero reiciendis velit similique earum",
"email": "Jayne_Kuhic@sydney.com",
"body": "est natus enim nihil est dolore omnis voluptatem numquam\net omnis occaecati quod ullam at\nvoluptatem error expedita pariatur\nnihil sint nostrum voluptatem reiciendis et"
}
]
```
into a result like this
```json
[
"Eliseo@gardner.biz",
"Jayne_Kuhic@sydney.com"
]
```

But I can't achieve the same thing in interactive mode. If I try typing `.[].email`, as soon as I type the second dot, it clears my prompt and refuses to dig into the array. Doing `.[0].email` works but only gives the first email.

Would this be a PR that you would support? I'm not familiar enough with the codebase to make this change myself yet, but if this is a change you would allow, I could try to start familiarizing myself to work through opening a PR.

Also if so, are there contribution docs anywhere? I couldn't find them. Thanks!

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.