All Projects → matthewadams → ymlx

matthewadams / ymlx

Licence: MIT license
Command-line YAML processor

Programming Languages

javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to ymlx

vim-localorie
A Vim plugin for easy look-up of translations for Rails i18n YAML keys.
Stars: ✭ 27 (-64.94%)
Mutual labels:  yml
Cfn Sphere
AWS CloudFormation stack management tool
Stars: ✭ 76 (-1.3%)
Mutual labels:  yml
Yaml Expander
Expands internal property references in a yaml file.
Stars: ✭ 137 (+77.92%)
Mutual labels:  yml
Carvel Ytt
YAML templating tool that works on YAML structure instead of text
Stars: ✭ 816 (+959.74%)
Mutual labels:  yml
Docker Compose
Collection of my docker-compose.yml files
Stars: ✭ 52 (-32.47%)
Mutual labels:  yml
Taffy
Test Automation Framework Based On Nosetests. ✨🍰✨
Stars: ✭ 94 (+22.08%)
Mutual labels:  yml
pollly
The simplest editor to translate apps & sites for YML files. Fast and Simple. Try now!
Stars: ✭ 32 (-58.44%)
Mutual labels:  yml
Setup Miniconda
Set up your GitHub Actions workflow with conda via miniconda
Stars: ✭ 222 (+188.31%)
Mutual labels:  yml
React
Smart Server Performance
Stars: ✭ 65 (-15.58%)
Mutual labels:  yml
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (+70.13%)
Mutual labels:  yml
Strictyaml
Type-safe YAML parser and validator.
Stars: ✭ 836 (+985.71%)
Mutual labels:  yml
Ymlparser
YML (Yandex Market Language) parser
Stars: ✭ 14 (-81.82%)
Mutual labels:  yml
Yq
Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
Stars: ✭ 1,688 (+2092.21%)
Mutual labels:  yml
Iot push
基于netty+mqtt3.1.1+springboot+jdk8 实现的 mqtt 服务端跟客户端
Stars: ✭ 353 (+358.44%)
Mutual labels:  yml
Sshkeydistribut0r
A tool to automate key distribution with user authorization
Stars: ✭ 153 (+98.7%)
Mutual labels:  yml
YmlGenerator
YML (Yandex Market Language) file generator
Stars: ✭ 96 (+24.68%)
Mutual labels:  yml
Data
Extended implementation of ArrayObject - useful collection for any config in your system (write, read, store, change, validate, convert to other format and etc).
Stars: ✭ 77 (+0%)
Mutual labels:  yml
api-spec
API Specififications
Stars: ✭ 30 (-61.04%)
Mutual labels:  yml
Neph
A modern command line job processor, similar with make command
Stars: ✭ 174 (+125.97%)
Mutual labels:  yml
Localappveyor
Run your AppVeyor builds, locally
Stars: ✭ 112 (+45.45%)
Mutual labels:  yml

Command-line YAML processing tool

Features

  • Plain JavaScript to manipulate document(s)

Install

$ npm install -g ymlx

Usage

Pipe into ymlx any YAML and anonymous function for reducing it.

$ cat my.yaml | ymlx [code ...]

Anonymous function

Use an anonymous function as reducer which gets YAML as an object and processes it:

$ echo 'foo: [bar: value]' | ymlx 'x => x.foo[0].bar'
value

this Binding

If you don't pass anonymous function param => ..., code will be automatically transformed into anonymous function. And you can get access to YAML by this keyword:

$ echo 'foo: [bar: value]' | ymlx 'this.foo[0].bar'
value

Multiple Documents

You can pass a YAML file with multiple documents (using the --- separator), and your commands will be applied to each document.

# test.yml
---
foo:
- bar: value
---
foo:
- bar: another
$ cat test.yml | ymlx 'this.foo[0].bar'
---
value
---
another

Chain

You can pass any number of anonymous functions for reducing JSON:

$ echo 'foo: [bar: value]' | ymlx 'x => x.foo' 'this[0]' 'this.bar'
value

Generator

If passed code contains yield keyword, generator expression will be used:

$ curl ... | ymlx 'for (let user of this) if (user.login.startsWith("a")) yield user'

Access to YAML through this keyword:

# test.yml
- a
- b
$ cat test.yml | ymlx 'yield* this'
- a
- b
$ cat test.yml | ymlx 'yield* this; yield "c";'
- a
- b
- c

Update

You can update existing YAML using spread operator:

$ echo 'count: 0' | ymlx '{...this, count: 1}'
count: 1

Use npm package

Use any npm package by installing globally or in the current working directory:

$ npm install lodash # -g if you want
$ cat 'count: 0' | ymlx 'require("lodash").keys(this)'
- count

Formatting

$ echo '[1,2,3]' | ymlx 'this.reduce((a,n) => a += n.toString(), "concat: ")'
'concat: 123'

Inspiration

ymlx was inspired by fx

Related

  • jq – cli JSON processor on C
  • jsawk – like awk, but for JSON
  • json – another JSON manipulating cli library
  • jl – functional sed for JSON on Haskell

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].