-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⭐ add simple accessors for dicts (#1695)
Accessing dict structures sometimes feels a bit painful: ```coffee dict["one"]["more"]["field"] ``` Luckily for us, this pattern is well-known in the framework that birthed the scripting part of MQL: JS. With that in mind: ```coffee dict.one.more.field ``` is a much better way of expressing this use-case. Now: combine this with the power of GraphQL, and all of a sudden you get something like this: ```coffee dict { one { more.field } another } ``` Here is an example of using it in this repo: ```graphql { Name Version Connectors { Name Short } } ``` If we run it like this: ```bash cnquery run -c "parse.json('providers/os/dist/os.json').params{Name Version Connectors {Name Short}} --json" ``` and prettify the output: ![image](https://github.com/mondoohq/cnquery/assets/1307529/195090b7-4c4e-40aa-83a7-f1744252032e) --------- Signed-off-by: Dominik Richter <[email protected]>
- Loading branch information
Showing
4 changed files
with
86 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters