grasmash / yaml-cli
A command line tool for reading and manipulating yaml files.
Installs: 12 182 724
Dependents: 10
Suggesters: 0
Security: 0
Stars: 22
Watchers: 3
Forks: 13
Open Issues: 3
Requires
- php: >=8.0
- dflydev/dot-access-data: ^3
- symfony/console: ^6 || ^7
- symfony/filesystem: ^6 || ^7
- symfony/yaml: ^6 || ^7
Requires (Dev)
- 3.x-dev
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.1
- 3.0.0
- 2.x-dev
- dev-master / 2.x-dev
- 2.0.2
- 2.0.1
- 2.0.0
- 1.x-dev
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2
- 0.1
- dev-dependabot/composer/guzzlehttp/psr7-2.5.0
- dev-grasmash-patch-2
- dev-grasmash-patch-1
- dev-php-73
- dev-symfony3x
- dev-update-dot-access
- dev-diff-command
This package is auto-updated.
Last update: 2024-11-29 17:59:05 UTC
README
Yet another command line tool for reading and manipulating yaml files, built on the Symfony console component.
Commands:
Installation
composer require grasmash/yaml-cli
Example usage:
./vendor/bin/yaml-cli get:value somefile.yml some-key
./vendor/bin/yaml-cli get:type somefile.yml some-key
./vendor/bin/yaml-cli lint somefile.yml
./vendor/bin/yaml-cli unset:value somefile.yml some-key
./vendor/bin/yaml-cli update:key somefile.yml old-key new-key
./vendor/bin/yaml-cli update:value somefile.yml some-key some-value
# Cast to boolean.
./vendor/bin/yaml-cli update:value somefile.yml some-key false
./vendor/bin/yaml-cli update:value somefile.yml some-key true
./vendor/bin/yaml-cli update:value somefile.yml some-key 0 --type=boolean
./vendor/bin/yaml-cli update:value somefile.yml some-key 0 --type=bool
# Cast to null.
./vendor/bin/yaml-cli update:value somefile.yml some-key null
./vendor/bin/yaml-cli update:value somefile.yml some-key ~ --type=null
# Cast to integer.
./vendor/bin/yaml-cli update:value somefile.yml some-key 1 --type=integer
./vendor/bin/yaml-cli update:value somefile.yml some-key 1 --type=int
# Cast to float/double/real.
./vendor/bin/yaml-cli update:value somefile.yml some-key 1.0 --type=float
./vendor/bin/yaml-cli update:value somefile.yml some-key 1.0 --type=double
./vendor/bin/yaml-cli update:value somefile.yml some-key 1.0 --type=real
# Forcibly cast to string for values that would otherwise be boolean or null.
./vendor/bin/yaml-cli update:value somefile.yml some-key true --type=string
./vendor/bin/yaml-cli update:value somefile.yml some-key false --type=string
./vendor/bin/yaml-cli update:value somefile.yml some-key null --type=string
Similar tools:
- Javascript - https://github.com/pandastrike/yaml-cli
- Ruby - https://github.com/rubyworks/yaml_command
- Python - https://github.com/0k/shyaml
Recognition
This project was inspired by the yaml commands in Drupal Console.