Dasel: Difference between revisions

From wikinotes
No edit summary
Line 21: Line 21:
     '.category.three'  '3'
     '.category.three'  '3'


# print 'foo.yml',  
# print 'foo.yml',
#  with obj['category']['three'] = "3" added,
#  with obj['category']['three'] = "3" added,
#  while also preserving comments
#  while also preserving comments
Line 32: Line 32:
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Examples -->
</blockquote><!-- Examples -->
= Datatypes =
<blockquote>
<syntaxhighlight lang="yaml">
string:    string
int:      integer
bool:      true/false
object:    a hash/map/dict
document:  replace a file's content
</syntaxhighlight>
</blockquote><!-- Datatypes -->

Revision as of 17:42, 29 August 2021

Inspired by jq and yq, but operates on json, yaml, toml, xml, csv.
Totally standalone, no runtime dependencies.

Documentation

official docs https://daseldocs.tomwright.me/
github https://github.com/TomWright/dasel

Examples

# modify 'foo.yml', adding obj['category']['three'] = "3"
dasel put string \
    -f foo.yml \
    '.category.three'  '3'

# print 'foo.yml',
#   with obj['category']['three'] = "3" added,
#   while also preserving comments
#
# see: https://stackoverflow.com/questions/14282617/hunk-1-failed-at-1-whats-that-mean
diff \
    <(dasel -f foo.yml) \
    <(dasel put string -f foo.yml -o - '.category.three' '3') \
    | patch -o - foo.yml

Datatypes

string:    string
int:       integer
bool:      true/false
object:    a hash/map/dict
document:  replace a file's content