| Crates.io | fast-yaml-cli |
| lib.rs | fast-yaml-cli |
| version | 0.5.0 |
| created_at | 2025-12-29 18:06:59.201872+00 |
| updated_at | 2026-01-19 04:02:44.036795+00 |
| description | Fast YAML command-line processor with validation and linting |
| homepage | |
| repository | https://github.com/bug-ops/fast-yaml |
| max_upload_size | |
| id | 2011061 |
| size | 207,553 |
Fast YAML command-line processor with validation and linting. Built on fast-yaml for high-performance YAML 1.2.2 processing.
cargo install fast-yaml-cli
[!TIP] Use
cargo binstall fast-yaml-clifor faster installation without compilation.
git clone https://github.com/bug-ops/fast-yaml
cd fast-yaml
cargo install --path crates/fast-yaml-cli
fy --version
fy --help
fy [OPTIONS] [FILE] <COMMAND>
# Parse from file
fy parse config.yaml
# Parse from stdin
echo "name: test" | fy parse
# Show parse statistics
fy parse --stats large.yaml
Single file:
# Format to stdout
fy format messy.yaml
# Custom indentation (2-8 spaces)
fy format --indent 4 --width 100 config.yaml
# Format in-place
fy format -i config.yaml
Batch mode (directories, globs, multiple files):
# Format entire directory (recursive)
fy format -i src/
# Format with glob pattern
fy format -i "configs/**/*.yaml"
# Multiple files
fy format -i file1.yaml file2.yaml file3.yaml
# Non-recursive directory formatting
fy format -i --no-recursive configs/
# Parallel processing with 8 workers
fy format -i -j 8 large-project/
# Read file paths from stdin
find . -name "*.yaml" | fy format -i --stdin-files
[!TIP] Batch mode automatically detects when processing multiple files, directories, or glob patterns. Use
-j Nto control parallelism (default: auto-detect CPU cores).
Include/exclude patterns:
# Format all YAML except tests
fy format -i --exclude "**/tests/**" configs/
# Format only production configs
fy format -i --include "prod-*.yaml" configs/
# Combine patterns (respects .gitignore by default)
fy format -i --include "*.yaml" --exclude "draft-*" ./
Dry run and output control:
# Preview changes without modifying files
fy format -n configs/
# Quiet mode (only show errors)
fy format -i -q large-project/
# Verbose mode (show each file processed)
fy format -i -v configs/
# YAML to JSON
fy convert json config.yaml > config.json
# JSON to YAML
fy convert yaml data.json > data.yaml
# Compact JSON (no pretty-print)
fy convert json --pretty=false app.yaml
# Lint with default rules
fy lint config.yaml
# Custom rules
fy lint --max-line-length 100 --indent-size 2 app.yaml
# JSON output for IDE integration
fy lint --format json config.yaml
| Command | Description |
|---|---|
parse |
Parse and validate YAML syntax |
format |
Format YAML with consistent style |
convert |
Convert between YAML and JSON |
lint |
Lint YAML with diagnostics |
| Option | Short | Description | Default |
|---|---|---|---|
--in-place |
-i |
Edit file in-place | - |
--output |
-o |
Write to file | stdout |
--format |
-f |
Output format (yaml/json/compact) | yaml |
--no-color |
- | Disable colored output | - |
--quiet |
-q |
Suppress non-error output | - |
--verbose |
-v |
Enable verbose output | - |
| Option | Short | Description | Default |
|---|---|---|---|
--jobs |
-j |
Number of parallel workers (0 = auto) | auto-detect |
--stdin-files |
- | Read file paths from stdin | - |
--include |
- | Include pattern (glob) | all files |
--exclude |
- | Exclude pattern (glob) | none |
--no-recursive |
- | Disable recursive directory traversal | recursive |
--dry-run |
-n |
Preview changes without modifying | - |
[!NOTE] Batch mode activates automatically when processing multiple paths, directories, glob patterns, or when using
--stdin-files,--include,--exclude, or--jobs.
| Feature | Default | Description |
|---|---|---|
colors |
Yes | Colored terminal output |
linter |
Yes | YAML linting capabilities |
all |
- | All features enabled |
Build with minimal features:
cargo build --release --no-default-features
[!NOTE] The
linterfeature adds thelintcommand. Without it, onlyparse,format, andconvertare available.
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Parse error |
| 2 | Lint errors found |
| 3 | I/O error |
| 4 | Invalid arguments |
# Validate all YAML files
find . -name "*.yaml" -exec fy parse {} \;
# Format and convert in one pipeline
cat config.yaml | fy format | fy convert json > config.json
# Check YAML before committing
git diff --name-only --cached -- '*.yaml' | xargs -I {} fy lint {}
# GitHub Actions
- name: Validate YAML
run: |
cargo install fast-yaml-cli
find . -name "*.yaml" -exec fy lint {} \;
Built on fast-yaml-core for optimal performance:
[!TIP] Batch mode provides 3-6x speedup on multi-core systems when processing 100+ files. Use
-j Nto control worker count.
Licensed under MIT or Apache-2.0 at your option.