GithubHelp home page GithubHelp logo

uzuko001 / vtl-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from plavjanik/vtl-cli

0.0 0.0 0.0 105 KB

Velocity Template Language (VTL) Command-line Interface

License: Eclipse Public License 2.0

Shell 3.25% Python 8.20% Java 88.55%

vtl-cli's Introduction

Velocity Template Language (VTL) Command-Line Interface

Build Status codecov CodeFactor

This is simple Java command-line application that uses Apache Velocity to 'merge' VTL templates from shell scripts.

Features:

  • Apache Velocity 1.7 template engine
  • Output to the console or to a file
  • Context variables can be provided in:
    • Command line parameters
    • Environment variables
    • YAML file
  • Configurable encoding for input and output
  • One small fully executable JAR file (no java -jar... on Linux and z/OS)
  • Works everywhere where is Java

Build

./gradlew build

Installation

  1. Download https://github.com/plavjanik/vtl-cli/releases/download/v0.1.1/vtl.zip:

     curl -LO https://github.com/plavjanik/vtl-cli/releases/download/v0.1.1/vtl.zip
    
  2. Extract it:

     unzip vtl.zip
    
  3. There are several files available:

    • vtl-cli.jar for execution by the java -jar vtl-cli.jar command
    • vtl for execution by the vtl command on Linux systems with java in PATH or JAVA_HOME set
    • zos/vtl for execution by the vtl command on z/OS systems

Usage

java -jar build/vtl-cli.jar templates/hello.vtl -c name=world

or

vtl templates/hello.vtl -c name=world

If the hello.vtl file contains:

Hello, ${name}!

Then the standard output of vtl-cli is:

Hello, world!

Syntax

vtl [-e] [-ie=<inputEncoding>] [-o=<outputFile>] [-oe=<outputEncoding>] [-y=<yamlContextFile>] [-ye=<yamlEncoding>]
    [-c=variable=value]... FILE

Parameters:
      FILE                 File with a Velocity template to process

Options:
      -ie, --input-encoding=<inputEncoding>
                           UTF8, ISO8859-1, Cp1047, ... - see https://goo.gl/yn2pJZ
  -c, --context=variable=value
                           Context variable for Velocity (can be repeated)
  -y, --yaml-context=<yamlContextFile>
                           YAML file with context variables
      -ye, --yaml-encoding=<yamlEncoding>
                           UTF8, ISO8859-1, Cp1047, ...
  -e, --env-context        Set the context variables from environment
  -o, --out=<outputFile>   Output file (default: print to console)
      -oe, --output-encoding=<outputEncoding>
                           UTF8, ISO8859-1, Cp1047, ...

Loading context from YAML file

You can write context variables into a YAML file - for example:

name: world

and the use it:

vtl --yaml-context templates/hello.yml templates/hello.vtl

If you have nested YAML properties like:

nested:
    name: world

you can references it as ${nested.name}.

VTL

The template language is described in Velocity User Guide.

Releasing

The new releases are done by Travis CI after new tag is created:

git tag v0.1.0
git push --tags

vtl-cli's People

Contributors

plavjanik avatar dependabot[bot] avatar vvvlc 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.