grasmash / yaml-cli
一款用于读取和操作yaml文件的命令行工具。
3.2.1
2024-04-23 02:10 UTC
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-08-29 17:31:08 UTC
README
又一个用于读取和操作yaml文件的命令行工具,基于Symfony控制台组件构建。
命令
安装
composer require grasmash/yaml-cli
示例用法
./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
类似工具
- JavaScript - https://github.com/pandastrike/yaml-cli
- Ruby - https://github.com/rubyworks/yaml_command
- Python - https://github.com/0k/shyaml
认可
本项目受到Drupal Console中yaml命令的启发。