Giter Site home page Giter Site logo

dreibh / yamlpal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jorisroovers/yamlpal

0.0 2.0 0.0 50 KB

Simple tool for modifying and searching yaml files while keeping the original file formatting.

License: MIT License

Shell 5.51% Python 94.49%

yamlpal's Introduction

yamlpal

Build Status PyPi Package Supported Python Versions

Simple tool for modifying and searching yaml files while keeping the original file formatting.

Yamlpal uses its own version of 'yamlpath', a syntax similar to xpath, to identify elements in a yaml file.

Basic usage:

# Installation
pip install yamlpal
# Inserting new content into files (output is printed to stdout by default)
$ yamlpal insert  -f examples/sample1.yml "bill-to/address/city" "newkey: value"
$ yamlpal insert -f examples/sample1.yml "invoice" @examples/insert-multiline.txt

# Specify files via stdin and modify the files directly inline instead of printing to stdout
$ find examples -name \*.yml | yamlpal insert --inline "invoice" "newkey: value"

# Finding content in files
$ yamlpal find  -f examples/sample1.yml "bill-to/address/city"
city: Royal Oak

# Specify a custom output format (run "yamlpal find --help" for details on format strings)
$ yamlpal find -f examples/sample1.yml --format "%{linenr} %{key} %{value}" "bill-to/address/city"
11 city Royal Oak

# Check that value matches a given regex
$ yamlpal check "bill-to/address/city" "Royal Oak" -f examples/sample1.yml

# Run yamlpal <command> --help for command specific help.
$ yamlpal insert --help
Usage: yamlpal insert [OPTIONS] NEEDLE NEWCONTENT

  Insert new content into a yaml file.

Options:
  -f, --file PATH  File to insert new content in. Can by specified multiple
                   times to modify multiple files. Files are not modified
                   inline by default. You can also provide (additional) file
                   paths via stdin.
  -i, --inline     Edit file inline instead of dumping it to std out.
  --help           Show this message and exit.

Wishlist

We maintain a wishlist on our wiki.

yamlpal's People

Contributors

jorisroovers avatar asottile avatar tonnydourado avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.