github.com/tomwright/dasel@v1.27.3/README.md (about) 1 # dasel 2 3 [![Gitbook](https://badges.aleen42.com/src/gitbook_1.svg)](https://daseldocs.tomwright.me) 4 [![Go Report Card](https://goreportcard.com/badge/github.com/TomWright/dasel)](https://goreportcard.com/report/github.com/TomWright/dasel) 5 [![PkgGoDev](https://pkg.go.dev/badge/github.com/tomwright/dasel)](https://pkg.go.dev/github.com/tomwright/dasel) 6 ![Test](https://github.com/TomWright/dasel/workflows/Test/badge.svg) 7 ![Build](https://github.com/TomWright/dasel/workflows/Build/badge.svg) 8 [![codecov](https://codecov.io/gh/TomWright/dasel/branch/master/graph/badge.svg)](https://codecov.io/gh/TomWright/dasel) 9 [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) 10 ![GitHub All Releases Downloads](https://img.shields.io/github/downloads/TomWright/dasel/total) 11 ![GitHub License](https://img.shields.io/github/license/TomWright/dasel) 12 [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/TomWright/dasel?label=latest%20release)](https://github.com/TomWright/dasel/releases/latest) 13 [![Homebrew tag (latest by date)](https://img.shields.io/homebrew/v/dasel)](https://formulae.brew.sh/formula/dasel) 14 15 Dasel (short for data-selector) allows you to query and modify data structures using selector strings. 16 17 Comparable to [jq](https://github.com/stedolan/jq) / [yq](https://github.com/kislyuk/yq), but supports JSON, YAML, TOML, XML and CSV with zero runtime dependencies. 18 19 ## One tool to rule them all 20 21 Say good bye to learning new tools just to work with a different data format. 22 23 Dasel uses a standard selector syntax no matter the data format. This means that once you learn how to use dasel you immediately have the ability to query/modify any of the supported data types without any additional tools or effort. 24 25 ![Update Kubernetes Manifest](update_kubernetes.gif) 26 27 ## Table of contents 28 29 - [Dasel](#dasel) 30 - [One tool to rule them all](#one-tool-to-rule-them-all) 31 - [Quickstart](#quickstart) 32 - [Completion](#completion) 33 - [Issue vs discussion](#issue-vs-discussion) 34 - [Features](#features) 35 - [Table of contents](#table-of-contents) 36 - [Documentation](#documentation) 37 - [Playground](#playground) 38 - [Benchmarks](#benchmarks) 39 - [Pre-Commit](#pre-commit) 40 41 ## Quickstart 42 43 Dasel is available on [homebrew](https://daseldocs.tomwright.me/installation#homebrew), [ASDF](https://daseldocs.tomwright.me/installation#asdf), [scoop](https://daseldocs.tomwright.me/installation#scoop), [docker](https://daseldocs.tomwright.me/installation#docker), [Nix](https://daseldocs.tomwright.me/installation#nix) or as [compiled binaries](https://daseldocs.tomwright.me/installation#manual) from the [latest release](https://github.com/TomWright/dasel/releases/latest). 44 45 ```bash 46 brew install dasel 47 ``` 48 49 You can also install a [development version](https://daseldocs.tomwright.me/installation#development-version) with: 50 51 ```bash 52 go install github.com/tomwright/dasel/cmd/dasel@master 53 ``` 54 55 For more information see the [installation documentation](https://daseldocs.tomwright.me/installation). 56 57 ### Select 58 59 ```bash 60 echo '{"name": "Tom"}' | dasel -r json '.name' 61 "Tom" 62 ``` 63 64 See [select documentation](https://daseldocs.tomwright.me/usage/select). 65 66 ### Convert json to yaml 67 68 ```bash 69 echo '{"name": "Tom"}' | dasel -r json -w yaml 70 name: Tom 71 ``` 72 73 See [select documentation](https://daseldocs.tomwright.me/usage/select). 74 75 ### Put 76 77 ```bash 78 echo '{"name": "Tom"}' | dasel put string -r json '.email' 'contact@tomwright.me' 79 { 80 "email": "contact@tomwright.me", 81 "name": "Tom" 82 } 83 ``` 84 85 See [put documentation](https://daseldocs.tomwright.me/usage/put). 86 87 ### Delete 88 89 ```bash 90 echo '{ 91 "email": "contact@tomwright.me", 92 "name": "Tom" 93 }' | dasel delete -p json '.email' 94 { 95 "name": "Tom" 96 } 97 ``` 98 99 See [delete documentation](https://daseldocs.tomwright.me/usage/delete). 100 101 ## Completion 102 103 If you want to use completion from the terminal you can do the following (using zsh in this example): 104 105 Add the following to `~/.zshrc` and reload your terminal. 106 ```bash 107 export fpath=(~/zsh/site-functions $fpath) 108 mkdir -p ~/zsh/site-functions 109 dasel completion zsh > ~/zsh/site-functions/_dasel 110 compinit 111 ``` 112 113 ## Pre-Commit 114 115 Add `dasel` hooks to `.pre-commit-config.yaml` file 116 117 ```yaml 118 - repo: https://github.com/TomWright/dasel 119 rev: v1.25.1 120 hooks: 121 - id: dasel-validate 122 ``` 123 124 for a native execution of dasel, or use: 125 126 - `dasel-validate-docker` pre-commit hook for executing dasel using the official [Docker images](https://daseldocs.tomwright.me/installation#docker) 127 - `dasel-validate-bin` pre-commit hook for executing dasel using the official [binary](https://daseldocs.tomwright.me/installation) 128 129 ## Issue vs Discussion 130 131 I have enabled [discussions](https://github.com/TomWright/dasel/discussions) on this repository. 132 133 I am aware there may be some confusion when deciding where you should communicate when reporting issues, asking questions or raising feature requests so this section aims to help us align on that. 134 135 Please [raise an issue](https://github.com/TomWright/dasel/issues) if: 136 137 - You find a bug. 138 - You have a feature request and can clearly describe your request. 139 140 Please [open a discussion](https://github.com/TomWright/dasel/discussions) if: 141 142 - You have a question. 143 - You're not sure how to achieve something with dasel. 144 - You have an idea but don't quite know how you would like it to work. 145 - You have achieved something cool with dasel and want to show it off. 146 - Anything else! 147 148 ## Features 149 150 - [Query/select data from structured data files](https://daseldocs.tomwright.me/usage/select). 151 - [Update data in structured data files](https://daseldocs.tomwright.me/usage/put). 152 - [Create data files](https://daseldocs.tomwright.me/usage/put#create-documents-from-scratch). 153 - [Supports multiple data formats/types](https://daseldocs.tomwright.me/usage/supported-file-types). 154 - [Convert between data formats/types](https://daseldocs.tomwright.me/notes/converting-between-formats). 155 - Uses a [standard query/selector syntax](https://daseldocs.tomwright.me/selectors/introduction) across all data formats. 156 - Zero runtime dependencies. 157 - [Available on Linux, Mac and Windows](https://daseldocs.tomwright.me/installation). 158 - Available to [import and use in your own projects](https://daseldocs.tomwright.me/use-as-a-go-package). 159 - [Run via Docker](https://daseldocs.tomwright.me/installation#docker). 160 - [Faster than jq/yq](#benchmarks). 161 - [Self update](https://daseldocs.tomwright.me/installation/update). 162 - [Pre-commit hooks](https://daseldocs.tomwright.me/usage/validate#pre-commit). 163 164 ## Documentation 165 166 The official dasel docs can be found at [daseldocs.tomwright.me](https://daseldocs.tomwright.me). 167 168 ## Playground 169 170 You can test out dasel commands using the [playground](https://dasel.tomwright.me). 171 172 Source code for the playground can be found at [github.com/TomWright/daselplayground](https://github.com/TomWright/daselplayground). 173 174 ## Benchmarks 175 176 In my tests dasel has been up to 3x faster than jq and 15x faster than yq. 177 178 See the [benchmark directory](./benchmark/README.md). 179 180 ## Stargazers over time 181 182 [![Stargazers over time](https://starchart.cc/TomWright/dasel.svg)](https://starchart.cc/TomWright/dasel)