Skip to content

essentialkaos/yo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

GitHub Actions Status codebeat badge

InstallationUsageBuild StatusContributingLicense


Yo is a command-line YAML processor.

Installation

From source

To build the Yo from scratch, make sure you have a working Go 1.19+ workspace (instructions), then:

go install github.com/essentialkaos/yo@latest
sudo yum install -y https://pkgs.kaos.st/kaos-repo-latest.el$(grep 'CPE_NAME' /etc/os-release | tr -d '"' | cut -d':' -f5).noarch.rpm
sudo yum install yo

Prebuilt binaries

You can download prebuilt binaries for Linux and macOS from EK Apps Repository:

bash <(curl -fsSL https://apps.kaos.st/get) yo

Usage

Usage: yo {options} query

Options

  --from-file, -f filename    Read data from file
  --no-color, -nc             Disable colors in output
  --help, -h                  Show this help message
  --version, -v               Show version

Examples

  cat file.yml | yo '.foo'
  Return value for key foo

  yo -f file.yml '.foo'
  Return value for key foo

  yo -f file.yml '.foo | length'
  Print value length

  yo -f file.yml '.foo[]'
  Return all items from array

  yo -f file.yml '.bar[2:]'
  Return subarray started from item with index 2

  yo -f file.yml '.bar[1,2,5]'
  Return items with index 1, 2 and 5 from array

  yo -f file.yml '.bar[] | length'
  Print array size

  yo -f file.yml '.xyz | keys'
  Print hash map keys

  yo -f file.yml '.xyz | keys | length'
  Print number of hash map keys

  yo -f file.yml '.xyz | keys | sort'
  Print sorted list of keys

Build Status

Branch Status
master CI
develop CI

Contributing

Before contributing to this project please read our Contributing Guidelines.

License

Apache License, Version 2.0