yarser

command module
v0.0.0-...-6d65cf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 1 Imported by: 0

README

yarser

Release

A CLI for parsing YAML anchors to plain YAML files.

yarser-demo

Features

  • Parses YAML anchors
  • Allows usage of .hidden nodes by adding the prefix . to a root node. All hidden nodes are omitted from the final result

In my tests, I use tests/github-action/my-action.yml as the source file, and the compiled result is tests/github-action/my-action-compiled.yml. Go ahead and check how it looks like after parsing (compiling) the source YAML file.

Getting Started

  1. Download the binary file from the releases page, for example 0.0.1rc3
    • macOS - Intel chips
    YARSER_OS="darwin" && \
    YARSER_ARCH="amd64" && \
    YARSER_VERSION="0.0.1rc3" && \
    curl -sL -o yarser "https://github.com/unfor19/yarser/releases/download/${YARSER_VERSION}/yarser_${YARSER_VERSION}_${YARSER_OS}_${YARSER_ARCH}"
    
    • macOS - M1 chips
    YARSER_OS="darwin" && \
    YARSER_ARCH="arm64" && \
    YARSER_VERSION="0.0.1rc3" && \
    curl -sL -o yarser "https://github.com/unfor19/yarser/releases/download/${YARSER_VERSION}/yarser_${YARSER_VERSION}_${YARSER_OS}_${YARSER_ARCH}"
    
    • Linux - amd64
    YARSER_OS="linux" && \
    YARSER_ARCH="amd64" && \
    YARSER_VERSION="0.0.1rc3" && \
    curl -sL -o yarser "https://github.com/unfor19/yarser/releases/download/${YARSER_VERSION}/yarser_${YARSER_VERSION}_${YARSER_OS}_${YARSER_ARCH}"
    
    YARSER_OS="linux" && \
    YARSER_ARCH="386" && \    
    YARSER_VERSION="0.0.1rc3" && \
    curl -sL -o yarser "https://github.com/unfor19/yarser/releases/download/${YARSER_VERSION}/yarser_${YARSER_VERSION}_${YARSER_OS}_${YARSER_ARCH}"   
    
  2. Set permissions to allow execution of yarser binary and move to /usr/local/bin dir
    chmod +x yarser && \
    sudo mv yarser "/usr/local/bin/yarser"
    
  3. Parse a YAML file once - here's the YAML file with anchors that I'm testing with my-action.yml
    SRC_FILE_PATH="tests/github-action/my-action.yml" && \
    DST_FILE_PATH=".my-action-compiled.yml" && \
    yarser parse --watch "$SRC_FILE_PATH" "$DST_FILE_PATH"
    # INFO[2021-08-21T19:10:25+03:00] Successfully parsed tests/github-action/my-action.yml to .my-action-compiled.yml
    # Check the file .my-action-compiled.yml
    
  4. Parse on save while editing the source file by adding the --watch flag
    SRC_FILE_PATH="tests/github-action/my-action.yml" && \
    DST_FILE_PATH=".my-action-compiled.yml" && \
    yarser parse --watch "$SRC_FILE_PATH" "$DST_FILE_PATH"
    
    # INFO[2021-08-21T19:13:47+03:00] Watching for changes in tests/github-action/my-action.yml ... 
    # INFO[2021-08-21T19:13:53+03:00] Successfully parsed tests/github-action/my-action.yml to .my-action-compiled.yml
    
    # Keep on editing and saving the source file, and it will automatically parse it
    

Authors

Created and maintained by Meir Gabay

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

Overview

Copyright © 2021 Meir Gabay <unfor19@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL