-
-
Save akovalyov/5fc16a72382afcc3f384c82eb74e3d45 to your computer and use it in GitHub Desktop.
Yaml for bash, php impl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: cat app/config/parameters.yml | bin/yq '[parameters][database_host]' | |
#!/usr/bin/env php | |
<?php | |
use Symfony\Component\Console\Input\ArgvInput; | |
use Symfony\Component\PropertyAccess\PropertyAccess; | |
use Symfony\Component\Yaml\Yaml; | |
$loader = require __DIR__ . '/../app/autoload.php'; | |
$input = new ArgvInput(); | |
$parsed = Yaml::parse(stream_get_contents(STDIN)); | |
exit(PropertyAccess::createPropertyAccessor()->getValue($parsed, $input->getFirstArgument()) . PHP_EOL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment