#toml #toml-parser #command-line #arguments-parser #information #obtaining #tq

bin+lib tomlq

用于从命令行获取TOML文件信息的工具

6个版本

0.1.6 2024年7月9日
0.1.5 2024年7月1日
0.1.0 2017年8月26日

#980解析器实现

Download history 190/week @ 2024-04-26 299/week @ 2024-05-03 237/week @ 2024-05-10 166/week @ 2024-05-17 148/week @ 2024-05-24 299/week @ 2024-05-31 371/week @ 2024-06-07 264/week @ 2024-06-14 195/week @ 2024-06-21 803/week @ 2024-06-28 667/week @ 2024-07-05 206/week @ 2024-07-12 221/week @ 2024-07-19 258/week @ 2024-07-26 460/week @ 2024-08-02 410/week @ 2024-08-09

1,388 每月下载次数

MIT 许可证

13KB
169 代码行

tq

此存储库之前可在 cryptaliagy/tq-rs 下使用,并由 crate tq-rs 提供。

当前版本的crate支持 tqtomlq 二进制文件。 wherever possible, tq 应该优先使用,tomlq 将在 0.2.0 版本(预定于2025年1月1日发布)中从crate中删除。

安装

  • 使用 cargo(从源码编译):cargo install tomlq
  • 使用 cargo-binstall(从Github发布页面下载):cargo binstall -y tomlq

tq-rs crate 迁移

tq-rs 迁移到 tomlq 所需的唯一步骤是将 cargo install(或 cargo binstall)步骤从引用 tq-rs 更改为引用 tomlq。 二进制文件具有相同的名称,用法也相同。

用法

注意:安装后使用 tq --help 获取更多信息

Cargo.toml 获取包版本

tq -f Cargo.toml 'package.version'

在 Github Actions 中将包版本作为作业输出导出

jobs:
  get-version:
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.get-version.outputs.version }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install cargo-binstall
        run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

      - name: Install tq
        run: cargo binstall -y tomlq

      - id: get-version
        name: Output the current version of the project
        run: echo "version=$(tq -f Cargo.toml 'package.version')" >> "$GITHUB_OUTPUT"

注意:有关如何使用此作业的信息,请参阅 发布管道文件

贡献

欢迎贡献!我只需要这个功能,所以没有在这上面花费额外的时间。如果你有想法,请随时创建一个issue,如果你实现了额外的功能,请随时创建一个PR!

许可证

MIT许可证下授权

依赖

~1–12MB
~88K SLoC