7 个版本 (4 个重大更改)
0.9.1 | 2023年10月25日 |
---|---|
0.9.0 | 2023年10月24日 |
0.8.1 | 2020年10月16日 |
0.8.0 | 2020年7月28日 |
0.5.0 | 2020年2月7日 |
#1264 在 开发工具
每月 99 次下载
在 cl 中使用
30KB
528 代码行
clparse
clparse
是一个命令行工具,用于解析使用 Keep A Changelog 格式的 CHANGELOG 文件。CHANGELOG 文件可以是 Markdown、JSON 或 YAML 格式,一旦解析,也可以输出为这些格式中的任何一种。
安装
Homebrew (macOS)
$ brew install marcaddeo/clsuite/clparse
Linux
$ curl -LO https://github.com/marcaddeo/clparse/releases/download/0.9.1/clparse-0.9.1-x86_64-unknown-linux-musl.tar.gz
$ tar czvf clparse-0.9.1-x86_64-unknown-linux-musl.tar.gz
$ sudo mv clparse /usr/local/bin/clparse
Cargo
$ cargo install clparse
用法
clparse 0.9.1
Marc Addeo <hi@marc.cx>
A command line tool for parsing CHANGELOG.md files that use the Keep A Changelog format.
USAGE:
clparse [FLAGS] [OPTIONS] <FILE>
FLAGS:
-h, --help Prints help information
-n, --no-wrap Disable wrapping of change entries of a release. By default, change entries are wrapped at 80
characters.
-V, --version Prints version information
OPTIONS:
-f, --format <format> Sets the output format of the parsed CHANGELOG [default: markdown] [possible values:
json, yaml, yml, markdown, md]
-s, --separator <separator> Sets the separator character used between version and date in a release heading
[default: -]
-w, --wrap-at <wrap-at> Specify how many characters to wrap change entries at [default: 80]
ARGS:
<FILE> The CHANGELOG file to parse. This should be either a Markdown, JSON, or Yaml representation of a
changelog. Use '-' to read from stdin.
示例
默认情况下,clparse
将解析输入文件,并以 markdown 格式输出变更日志。
$ clparse CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Fix a bug that caused undefined behavior
## [1.0.0] - 2019-06-20
### Added
- Add a cool new feature
### Changed
- Change something that was notable
## [0.0.1] - 2019-05-31
### Added
- Add the initial features
我们可以将 markdown 转换为易于在脚本中使用的格式
$ clparse -f json CHANGELOG.md
{
"title": "Changelog",
"description": "All notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n",
"releases": [
{
"version": null,
"link": "https://github.com/example/example/compare/v1.0.0...HEAD",
"date": null,
"changes": [
{
"fixed": "Fix a bug that caused undefined behavior"
}
],
"yanked": false
},
{
"version": "1.0.0",
"link": "https://github.com/example/example/compare/v0.0.1...v1.0.0",
"date": "2019-06-20",
"changes": [
{
"added": "Add a cool new feature"
},
{
"changed": "Change something that was notable"
}
],
"yanked": false
},
{
"version": "0.0.1",
"link": "https://github.com/example/example/releases/tag/v0.0.1",
"date": "2019-05-31",
"changes": [
{
"added": "Add the initial features"
}
],
"yanked": false
}
]
}
clparse
也可以解析变更日志的 JSON 和 YAML 表示形式
$ clparse CHANGELOG.json
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Fix a bug that caused undefined behavior
## [1.0.0] - 2019-06-20
### Added
- Add a cool new feature
### Changed
- Change something that was notable
## [0.0.1] - 2019-05-31
### Added
- Add the initial features
最后,我们可以通过将 -
作为 FILE
参数传递给 stdin 来读取
$ clparse -f json CHANGELOG.md | clparse -
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Fix a bug that caused undefined behavior
## [1.0.0] - 2019-06-20
### Added
- Add a cool new feature
### Changed
- Change something that was notable
## [0.0.1] - 2019-05-31
### Added
- Add the initial features
依赖项
~8.5MB
~165K SLoC