Saturday, January 11

TomWright/dasel: Select, put and erase information from JSON, TOML, YAML, XML and CSV

videobacks.net

dasel

Dasel (brief for -selector) permits you to query and utilizing selector strings.

Equivalent to jq/ yq, however supports JSON, YAML, TOML, XML and CSV with no runtime dependences.

One to rule them

great bye to finding out - simply to with various information .

Dasel utilizes a basic selector syntax no matter information format. This indicates that as soon as you discover how to utilize dasel you away have the to query/modify any of the supported information with no extra tools or .

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

Quickstart

Dasel is readily available homebrew, ASDF, scoop, docker, Nix or as put together binaries from the most recent .

You can likewise up an advancement variation with:

go set up .com/tomwright/dasel/v2/cmd/dasel@

To more see the paperwork.

echo' ‘|dasel json ‘name' “

See choose documents.

Transform json to yaml

echo' “name”: “Tom”‘|dasel -r json - yaml name: Tom

See choose documents.

Put

echo' “name”: “Tom”‘|dasel put -r json - string -@tomwright.me' 'em ail' “e-”: “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 you can do the following (utilizing zsh in this example):

Include the following to ~/. zshrc and refill your terminal.

fpath =-LRB- ~/ zsh/-functions $fpath) mkdir - ~/ zsh/site-functions dasel conclusion zsh > > ~/ zsh/site-functions/ _ dasel compinit

Pre-Commit

Include dasel to.pre-commit-config. yaml file

– repo: https://github.com/TomWright/dasel rev: v1.25.1 hooks: – id: dasel-validate

for a native of dasel, or usage:

  • dasel-validate-docker pre-commit hook for performing dasel utilizing the main Docker
  • dasel-validate-bin pre-commit hook for carrying out dasel utilizing the main binary

vs

have actually made it possible for conversations on this repository.

ยป …
Find out more

videobacks.net