dasel
Dasel (brief for data-selector) permits you to query and customize information structures utilizing selector strings.
Equivalent to jq/ yq, however supports JSON, YAML, TOML, XML and CSV with no runtime dependences.
State great bye to finding out brand-new tools simply to deal with a various information format.
Dasel utilizes a basic selector syntax no matter the information format. This indicates that as soon as you discover how to utilize dasel you right away have the capability to query/modify any of the supported information types with no extra tools or effort.
Commands carried out in the demonstration # Piping information into dasel echo' ‘|dasel -r json ‘demonstration' # Fetch dasel releases from github api curl -L -H “Accept: application/vnd. github+json” -H “X-GitHub-Api-Version: 2022-11-28” https://api.github.com/repos/TomWright/dasel/releases > > releases.json less releases.json # Extract and structure release information by variation with download URL's by property name dasel -f releases.json -w yaml ‘all(). mapOf(variation, tag_name, download, assets.all(). mapOf(name, name, url, browser_download_url). combine()). combine()' > > releases_download. yaml less releases_download. yaml # Restructure the above information into CSV format, destructuring into rows. dasel -f releases_download. yaml -w csv ‘all(). download.all(). mapOf(variation, moms and dad( 2 ). variation, name, name, url, url). combine()' > > releases_download. csv less releases_download. csv # Fetch the very first CSV row and output as JSON dasel -f releases_download. csv -w json ‘very first()'
Tabulation
- Dasel
- One tool to rule them all
- Quickstart
- Conclusion
- Problem vs conversation
- Functions
- Tabulation
- Documents
- Play area
- Standards
- Pre-Commit
Quickstart
Dasel is readily available on homebrew, ASDF, scoop, docker, Nix or as put together binaries from the most recent release.
You can likewise set up an advancement variation with:
go set up github.com/tomwright/dasel/v2/cmd/dasel@master
To learn more see the setup paperwork.
echo' ‘|dasel -r json ‘name' “Tom”
See choose documents.
Transform json to yaml
echo' “name”: “Tom”‘|dasel -r json -w yaml name: Tom
See choose documents.
Put
echo' “name”: “Tom”‘|dasel put -r json -t string -v ‘contact@tomwright.me' 'em ail' “e-mail”: “contact@tomwright.me”, “name”: “Tom”
See put documents.
Erase
echo' ‘|dasel erase -r json ‘. e-mail'
See erase paperwork.
Conclusion
If you wish to utilize conclusion from the terminal you can do the following (utilizing zsh in this example):
Include the following to ~/. zshrc and refill your terminal.
export fpath =-LRB- ~/ zsh/site-functions $fpath) mkdir -p ~/ zsh/site-functions dasel conclusion zsh > > ~/ zsh/site-functions/ _ dasel compinit
Pre-Commit
Include dasel hooks to.pre-commit-config. yaml file
– repo: https://github.com/TomWright/dasel rev: v1.25.1 hooks: – id: dasel-validate
for a native execution of dasel, or usage:
- dasel-validate-docker pre-commit hook for performing dasel utilizing the main Docker images
- dasel-validate-bin pre-commit hook for carrying out dasel utilizing the main binary
I have actually made it possible for conversations on this repository.