diff --git a/README.md b/README.md index 264240f..20fde4e 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,68 @@ # google-yamlfmt -google-yamlfmt 是一个二次打包 [yamlfmt](https://github.com/google/yamlfmt) 的仓库。 +A PyPI packaging repository for [yamlfmt](https://github.com/google/yamlfmt), making it easily accessible to the Python ecosystem. -## 特性 +## Overview -- 可以使用 pip 或任意 python 包管理工具安装 +This repository provides a Python package wrapper for Google's `yamlfmt` tool, enabling seamless integration with Python package managers and development workflows. The original `yamlfmt` is a powerful YAML formatter written in Go, and this package makes it available through PyPI for easier installation and use in Python projects. -## 安装 +## Features -要安装 google-yamlfmt,请确保您的 Python 版本为 3.9 或更高,然后运行以下命令: +- **Easy Installation**: Install via pip or any Python package manager +- **Python Ecosystem Integration**: Works seamlessly with Python development workflows +- **Pre-commit Support**: Perfect for use with pre-commit hooks +- **Cross-platform**: Available on all platforms supported by the original yamlfmt + +## Installation + +To install google-yamlfmt, ensure you have Python 3.9 or higher, then run: ```bash pip install google-yamlfmt ``` -## 使用 +## Usage -安装完成后,您可以通过以下命令格式化 YAML 文件: +After installation, you can format YAML files using the `yamlfmt` command: ```bash yamlfmt ``` -例如: +Examples: ```bash +# Format a single file yamlfmt example.yaml + +# Format multiple files +yamlfmt file1.yaml file2.yaml + +# Format all YAML files in current directory +yamlfmt *.yaml + +# Check if files need formatting (lint mode) +yamlfmt -lint example.yaml +``` + +For more advanced usage options and configuration, please refer to the [original documentation](https://github.com/google/yamlfmt/blob/main/docs/command-usage.md) or run `yamlfmt -h`. + +### Pre-commit Integration + +To use with pre-commit, add this to your `.pre-commit-config.yaml`: + +```yaml +repos: + - repo: https://github.com/PFCCLab/yamlfmt-pre-commit-mirror.git + rev: v0.17.2 + hooks: + - id: yamlfmt ``` -## 贡献 +## About + +This package is a redistribution of the original [yamlfmt](https://github.com/google/yamlfmt) tool created by Google. All credit for the core functionality goes to the original maintainers. This packaging effort aims to make the tool more accessible to Python developers and integrate better with Python-based development workflows. + +## Contributing -欢迎对本项目进行贡献!您可以通过提交问题或拉取请求来帮助改进此工具。 +Contributions are welcome! Please feel free to submit issues or pull requests to help improve this packaging and distribution effort.