Code Monkey home page Code Monkey logo

yamltools's Introduction

yannoff/yamltools

The YAML Tools Project: A command-line swiss-knife for YAML, written in PHP.

Latest Stable Version Total Downloads License

Requirements

Installation

Quick install

Option A: As a composer global package

The yamltools phar may be installed as a global package using composer or offenbach.

composer global require yannoff/yamltools

or

offenbach global require yannoff/yamltools

The $COMPOSER_HOME/vendor/bin directory have to be in the PATH system-wide environment variable.

Option B: Manual download

Get the latest release and install it

curl -Lo /usr/bin/yamltools https://github.com/yannoff/yamltools/releases/latest/download/yamltools
chmod +x /usr/bin/yamltools

The /usr/bin/yamltools path is just an example, fell free to replace by any custom binary file path.

Advanced install

  1. Clone or fetch a zipball from this repository
  2. Run configure if you want to fine-tune installation parameters (run ./configure --help to see available options and invocation modus operandi).
  3. Compille & install: make && sudo make install

Usage

The YAML Tools Project comes with several utilities to handle YAML from the command-line:

  • Converter : Juggle easily between JSON & YAML formats
  • Comments : Manipulate YAML comments: export, import & merge

Acknowledgement

The YAML Tools Project is based on the well-known symfony/yaml component, which implements its own engine to dump/parse YAML data.

Two reasons motivated the choice:

  • The component is a standalone, pure PHP implementation: no need to have the Yaml PHP extension installed, guaranteeing a wider support for many platforms.
  • The dumps are more pretty-print oriented, and more flexible, allowing to customize indentation and inline wrapping level.

The major drawback on the other hand is that the component is not fully compliant with YAML Standards.

Credits

Licensed under the MIT License.

yamltools's People

Contributors

dependabot[bot] avatar yannoff avatar

Stargazers

 avatar

Watchers

 avatar  avatar

yamltools's Issues

[comments] Merge command hangs when source file contents out-of-indent comments

Problem

Given the following source & destination files:

source.yaml

name: yannoff/yamltools
description: 'A command-line Swiss-Knife for YAML files'
homepage: 'https://github.com/yannoff/yamltools'
type: console-script
require:
    php: '>=5.6.40'
# Should work even without, since the JSON ext is now a built-in php module
    ext-json: '*'
    symfony/yaml: ^3.4

dest.yaml

name: yannoff/yamltools
description: 'A command-line Swiss-Knife for YAML files'
homepage: 'https://github.com/yannoff/yamltools'
type: console-script
require:
    php: '>=5.6.40'
    ext-json: '*'
    symfony/yaml: ^3.4

The following merge command attempt hangs and never terminate:

$ yamltools yaml:comments:merge source.yaml dest.yaml

Explanation

The YPath calculated by the Contents::getParentYPath() method of the yannoff/y-a-m-l library is wrong, since the comment is mistakenly interpreted as the parent level line, whereas it should not

Support for PHP < 7.1.0 broken

 $ ./test-all.sh 
-----------------------------------------------------------------
PHP Version: 5.6.40
Run command: bin/application.php convert:json:yaml composer.json

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.1.0". You are running 5.6.40. in /var/www/html/vendor/composer/platform_check.php on line 25
-----------------------------------------------------------------
PHP Version: 7.0.33
Run command: bin/application.php convert:json:yaml composer.json

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.1.0". You are running 7.0.33. in /var/www/html/vendor/composer/platform_check.php on line 24

Introduced by #10

Indeed, while this should never happen, a minor version of the symfony/polyfill-ctype package introduced a breaking change:

  • v1.19.0 supports PHP version >=5.3.3
  • v1.20.0 supports PHP version >=7.1

Kudos to the symfony team, again ๐Ÿ‘ฟ

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.