#label #github #chevdor #yaml #command-line-tool #cli #rust

app glabel

一个用 Rust 编写的命令行工具,允许您获取项目的所有标签,将其保存为 YAML 文件以便轻松编辑或作为备份,并将保存的预设应用到新的仓库中。

7 个版本

0.0.6 2022 年 6 月 24 日
0.0.5 2022 年 6 月 24 日
0.0.4 2021 年 12 月 8 日
0.0.0 2021 年 11 月 17 日

#2877命令行工具

MIT 许可证

21KB
244

glabel

简介

用于导入(=get)和导出(=apply)Github 标签的实用工具。

安装

cargo install --git https://github.com/chevdor/glabel --locked
glabel --help

您还可以启用 wipe 功能,但请注意,除非您非常了解自己在做什么,否则风险相当高。

用法

帮助

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    apply    Apply a label set from a given file
    get      Get/download labels from a given repository
    help     Print this message or the help of the given subcommand(s)

获取

ARGS:
    <REPOSITORY>    The repo string for now in the form owner/repo such as chevdor/foobar

OPTIONS:
    -h, --help               Print help information
    -o, --output <OUTPUT>    The output filename
    -V, --version            Print version information

如果不传递 --output|-o 标志,标签将显示在您的终端中

但是,如果您提供输出文件,yaml 将存储为

---
name: chevdor/glabel
description: Import from chevdor/glabel
labels:
  - name: bug
    description: "Something isn't working"
    color: d73a4a
  - name: documentation
    description: Improvements or additions to documentation
    color: 0075ca
  - name: duplicate
    description: This issue or pull request already exists
    color: cfd3d7
  - name: enhancement
    description: New feature or request
    color: a2eeef
  - name: good first issue
    description: Good for newcomers
    color: 7057ff
  - name: help wanted
    description: Extra attention is needed
    color: "008672"
  - name: invalid
    description: "This doesn't seem right"
    color: e4e669
  - name: question
    description: Further information is requested
    color: d876e3
  - name: wontfix
    description: This will not be worked on
    color: ffffff

应用

ARGS:
    <REPOSITORY>    The repo string for now in the form owner/repo such as chevdor/foobar
    <INPUT>         The filename where your set is stored

OPTIONS:
    -d, --dry-run          Do not change anything, print only what will be done
    -h, --help             Print help information
    -r, --replace          By default, existing labels will NOT be updated. If you set this flag to
                           true, they will. Beware, there is no automatic backup so it could be a
                           good idea to run the `get` command first and make a backup
    -t, --token <TOKEN>    If you follow good security practices, your GITHUB_TOKEN should not have
                           write access to your repos. Here since we need to write labels, we use
                           another variable for the token with write access. It is highly
                           recommended to pass this as an Environment variable [env: TOKEN=<your
                           admin token>]
    -V, --version          Print version information

擦除

    glabel wipe [OPTIONS] --token <TOKEN> <REPOSITORY>

ARGS:
    <REPOSITORY>    The repo string for now in the form owner/repo such as chevdor/foobar

OPTIONS:
    -a, --apply            By default, for your safety, the command will NOT do anything. If you
                           however pass this flag, there will be no way back :) It is highly
                           recommended to call `get` first and backup your labels but keep in mind
                           that it does not save which labels are applied to PRs and issues. So if
                           you have labels "in use", you will lose them
    -h, --help             Print help information
    -t, --token <TOKEN>    If you follow good security practices, your GITHUB_TOKEN should not have
                           write access to your repos. Here since we need to write labels, we use
                           another variable for the token with write access. It is highly
                           recommended to pass this as an Environment variable [env: TOKEN=<your
                           admin token>]
    -V, --version          Print version information

文档

如果您想偷懒(并感到愉快),您甚至可以使用 tera-cli 从您的标签生成文档。

使用此仓库中的 模板 和以下命令

tera --template templates/doc.md.tera doc/sample_yaml.yaml

将生成以下输出

This is the documentation for your set named `chevdor/glabel`.

It contains 9 labels:

- `bug`: *Something isn't working*
- `documentation`: *Improvements or additions to documentation*
- `duplicate`: *This issue or pull request already exists*
- `enhancement`: *New feature or request*
- `good first issue`: *Good for newcomers*
- `help wanted`: *Extra attention is needed*
- `invalid`: *This doesn't seem right*
- `question`: *Further information is requested*
- `wontfix`: *This will not be worked on*

依赖项

~21–35MB
~644K SLoC