2017 © Pedro Peláez
 

library goggle

Introspect and edit config values from the command line

image

zicht/goggle

Introspect and edit config values from the command line

  • Monday, February 20, 2017
  • by muhammedeminakbulut
  • Repository
  • 0 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

Goggle

      /)        /)
     /__   ___/
    (_._)-(_._)

Not to be confused with Google. Google finds anything, Goggle will help you look at anything., (*1)

Nearly anything ;), (*2)

What is it?

A command line tool to easily read values from config files and output them in several different formats, with chaining through piping in mind., (*3)

Supported formats

  • Input: json, yaml and ini
  • Output: json, yaml, ini, text (column based), formatted console table, markdown table

Usage

Read a 'deep' value from a configuration file

goggle get -i FILE element0..elementN [-O=FORMAT]

Read value FILE from path element0..elementN and output it in the specified format., (*4)

For example given a JSON string {"a": {"b": {"c": 123}}}, reading the value '123' would be done by executing goggle get a b c, (*5)

Process a set of values

# Each of the records in the file FILE will be mapped by key `name`, and only fields
# 'author' and 'name'  are kept, other fields are dropped.

goggle process -i FILE mapBy name fields author name 

Example

Example 1

Show package names, versions and authors, extracted from composer.lock, (*6)

goggle get -i ./composer.lock packages \
    | goggle process -I json fields name version authors \
    | goggle process -I json mapBy name 

Or only get the one for symfony/symfony:, (*7)

goggle get -i ./composer.lock packages | goggle process -I json fields name version authors | goggle process -I json mapBy name | goggle get "symfony/symfony"

Example 2

Read the database host name from the following file and output it's value:, (*8)

goggle get -I yaml parameters database_host -O json -O text < app/config/parameters_staging.yml

Given the following file:, (*9)

parameters:
    database_host: foo

This would output:, (*10)

foo

Example 3

See all values available in a composer lock file, (*11)

goggle get -i composer.lock -O dump

Or read all package names and versions from a composer lockfile:, (*12)

goggle get -i composer.lock | goggle fields name version

Example 4

Or simply convert yml to json:, (*13)

goggle get app/config/parameters.yml -O json

or:, (*14)

goggle get -I yaml -o json < ./app/config/parameters.yml

Example 5

Set the database host name in the following file:, (*15)

parameters:
    database_host: localhost

Running this:, (*16)

goggle set -e app/config/parameters_staging.yml parameters database_host remote_host

Will change the value to:, (*17)

parameters:
    database_host: remote_host

Of course the -e flag is especially useful for this command, but it's not compulsory., (*18)

More documentation by example

Read the behat features to see more possibilities., (*19)

Reference

Read the wiki for a more detailed reference., (*20)

The Versions

20/02 2017
08/07 2016

dev-release/1.x

dev-release/1.x

  Sources   Download

The Requires

 

08/07 2016
21/06 2016
21/06 2016